fishbowl/engine/include/fishbone/thread.h

43 lines
717 B
C++

#ifndef __FISHBONE_THREAD_H__
#define __FISHBONE_THREAD_H__
namespace fishbone {
class Thread;
class Mutex;
}; // namespace fishbone
#include <fishbone/machdep.h>
namespace fishbone {
class Thread {
struct Impl;
Impl* impl;
public:
using Callable = void(*)(fishbone::Thread* thread, void* arg);
using CallableFunc = std::function<void(fishbone::Thread* thread)>;
Thread(Callable call, void* arg);
Thread(CallableFunc call);
~Thread();
void join();
};
class Mutex {
struct Impl;
Impl* impl;
public:
Mutex();
~Mutex();
Mutex(const Mutex&) = delete;
Mutex& operator=(const Mutex&) = delete;
void lock();
void unlock();
};
}; // namespace fishbone
#endif