29 #ifndef PT_SYSTEM_THREAD_H
30 #define PT_SYSTEM_THREAD_H
32 #include <Pt/System/Api.h>
33 #include <Pt/NonCopyable.h>
34 #include <Pt/Callable.h>
35 #include <Pt/Function.h>
36 #include <Pt/Method.h>
119 bool isJoinable()
const
120 {
return _state == Running; }
170 class ThreadImpl* _impl;
243 Thread::joinNoThrow();
283 typedef void (*FuncPtrT)();
340 #endif // PT_SYSTEM_THREAD_H
static void sleep(unsigned int ms)
Sleep for some time.
Core module.
Definition: Allocator.h:33
Thread(const Callable< void > &cb)
Constructs a thread with a thread entry.
AttachedThread(const Callable< void > &cb)
Constructs a thread with a thread entry.
Definition: Thread.h:226
An interface for all callable entities.
Definition: Api-Callable.h:17
A Joinable thread.
Definition: Thread.h:209
static void exit()
Exits athread.
State state() const
Returns the current state of the thread.
Definition: Thread.h:116
virtual ~Thread()
Destructor.
void join()
Wait for the thread to finish execution.
Thread(EventLoop &loop)
Constructs a thread with an event loop.
void detach()
Detaches the thread.
virtual void run()
Thread entry method.
Definition: Thread.h:324
~AttachedThread()
Joins the thread, if not already joined.
Definition: Thread.h:241
AttachedThread()
Default Constructor.
Definition: Thread.h:216
Thread-safe event loop supporting I/O multiplexing and Timers.
Definition: EventLoop.h:74
A detached thread.
Definition: Thread.h:282
Platform independent threads.
Definition: Thread.h:65
AttachedThread(EventLoop &loop)
Constructs a thread with an event loop.
Definition: Thread.h:236
virtual void destroy()
Destroys a detached thread.
Definition: Thread.h:316
Protects derived classes from being copied.
Definition: NonCopyable.h:54
static void yield()
Yield CPU time.
Thread()
Default Constructor.
DetachedThread()
Constructs a detached thread.
Definition: Thread.h:301
State
Status of a thread.
Definition: Thread.h:69
void start()
Starts the thread.
void init(const Callable< void > &cb)
Initialize with a thread entry.