thread/Thread: use BoundMethod
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#define MPD_THREAD_HXX
|
||||
|
||||
#include "check.h"
|
||||
#include "util/BindMethod.hxx"
|
||||
#include "Compiler.h"
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -32,6 +33,9 @@
|
||||
#include <assert.h>
|
||||
|
||||
class Thread {
|
||||
typedef BoundMethod<void()> Function;
|
||||
const Function f;
|
||||
|
||||
#ifdef WIN32
|
||||
HANDLE handle = nullptr;
|
||||
DWORD id;
|
||||
@@ -49,11 +53,8 @@ class Thread {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void (*f)(void *ctx);
|
||||
void *ctx;
|
||||
|
||||
public:
|
||||
Thread() = default;
|
||||
explicit Thread(Function _f):f(_f) {}
|
||||
|
||||
Thread(const Thread &) = delete;
|
||||
|
||||
@@ -89,7 +90,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
void Start(void (*f)(void *ctx), void *ctx);
|
||||
void Start();
|
||||
void Join();
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user