17 INLINE
Thread *ThreadSimpleImpl::
18 get_current_thread() {
27 INLINE
bool ThreadSimpleImpl::
28 is_same_system_thread()
const {
29 #ifdef HAVE_POSIX_THREADS 30 return pthread_equal(_posix_system_thread_id, pthread_self());
33 return (_win32_system_thread_id == GetCurrentThreadId());
42 INLINE
void ThreadSimpleImpl::
49 INLINE
bool ThreadSimpleImpl::
50 is_threading_supported() {
57 INLINE
bool ThreadSimpleImpl::
65 INLINE
void ThreadSimpleImpl::
66 sleep(
double seconds) {
67 ThreadSimpleManager *manager = ThreadSimpleManager::get_global_ptr();
68 if (manager->is_same_system_thread()) {
69 ThreadSimpleImpl *thread = manager->get_current_thread();
70 thread->sleep_this(seconds);
72 manager->system_sleep(seconds);
79 INLINE
void ThreadSimpleImpl::
81 ThreadSimpleManager *manager = ThreadSimpleManager::get_global_ptr();
82 if (manager->is_same_system_thread()) {
83 ThreadSimpleImpl *thread = manager->get_current_thread();
84 thread->yield_this(
true);
86 manager->system_yield();
93 INLINE
void ThreadSimpleImpl::
95 ThreadSimpleManager *manager = ThreadSimpleManager::get_global_ptr();
96 if (manager->is_same_system_thread()) {
97 ThreadSimpleImpl *thread = manager->get_current_thread();
98 thread->consider_yield_this();
105 INLINE
void ThreadSimpleImpl::
106 consider_yield_this() {
107 double now = _manager->get_current_time();
108 if (now >= _stop_time) {
116 INLINE
double ThreadSimpleImpl::
117 get_wake_time()
const {
124 void ThreadSimpleImpl::
125 write_status(std::ostream &out) {
126 ThreadSimpleManager *manager = ThreadSimpleManager::get_global_ptr();
127 manager->write_status(out);
get_current_thread
Returns a pointer to the currently-executing Thread object.
A thread; that is, a lightweight process.