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>
136 bool isJoinable()
const
137 {
return _state == Running; }
187 class ThreadImpl* _impl;
233 Thread::joinNoThrow();
249 typedef void (*FuncPtrT)();
An interface for all callable entities.
Definition Callable.h:48
ConstMethod< R, ClassT, As... > callable(ClassT &object, R(BaseT::*method)(As...) const)
Returns a ConstMethod object for the given object/method pair.
Definition ConstMethod.h:161
NonCopyable()
Default constructor.
Definition NonCopyable.h:63
AttachedThread(EventLoop &loop)
Constructs a thread with an event loop.
Definition Thread.h:226
~AttachedThread()
Joins the thread, if not already joined.
Definition Thread.h:231
AttachedThread()
Default Constructor.
Definition Thread.h:206
AttachedThread(const Callable< void > &cb)
Constructs a thread with a thread entry.
Definition Thread.h:216
Thread that runs without a waiter.
Definition Thread.h:248
DetachedThread()
Constructs a detached thread.
Definition Thread.h:267
virtual void run()
Thread entry method.
Definition Thread.h:290
virtual void destroy()
Destroys a detached thread.
Definition Thread.h:282
Event loop of a thread or process.
Definition EventLoop.h:83
Thread(EventLoop &loop)
Constructs a thread with an event loop.
virtual ~Thread()
Destructor.
static void sleep(unsigned int ms)
Sleep for some time.
State
Status of a thread.
Definition Thread.h:86
@ Ready
Not started yet.
Definition Thread.h:87
@ Running
Thread is running.
Definition Thread.h:88
@ Joined
Joined with parent thread.
Definition Thread.h:89
@ Detached
Detached from parent thread.
Definition Thread.h:90
void start()
Starts the thread.
void join()
Wait for the thread to finish execution.
Thread()
Default Constructor.
Thread(const Callable< void > &cb)
Constructs a thread with a thread entry.
void init(const Callable< void > &cb)
Initialize with a thread entry.
static void exit()
Exits athread.
void detach()
Detaches the thread.
State state() const
Returns the current state of the thread.
Definition Thread.h:133
static void yield()
Yield CPU time.
System programming
Definition Connection.h:26
Core module.
Definition Allocator.h:33