fishbowl/engine/include/fishbone/thread.h
2026-06-01 13:50:35 +09:00

45 lines
742 B
C++

#ifndef __FISHBONE_THREAD_H__
#define __FISHBONE_THREAD_H__
#include <fishbone/pre.h>
namespace fishbone {
class Thread;
class Mutex;
}; // namespace fishbone
/* no includes */
namespace fishbone {
class Thread {
struct Impl;
Impl* impl;
public:
using Callable = void (*)(fishbone::Thread* thread, void* arg);
using CallableLambda = std::function<void(fishbone::Thread* thread)>;
Thread(Callable call, void* arg);
Thread(CallableLambda 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