Thread::is_simple_threads()

This commit is contained in:
David Rose 2010-05-01 19:21:58 +00:00
parent 0b9016ab01
commit 5e09cff612
10 changed files with 65 additions and 0 deletions

View File

@ -205,6 +205,26 @@ is_true_threads() {
return ThreadImpl::is_true_threads();
}
////////////////////////////////////////////////////////////////////
// Function: Thread::is_simple_threads
// Access: Published, Static
// Description: Returns true if Panda is currently compiled for
// "simple threads", which is to say, cooperative
// context switching only, reducing the need for quite
// so many critical section protections. This is not
// necessarily the opposite of "true threads", since one
// possible implementation of simple threads is via true
// threads with mutex protection to ensure only one runs
// at a time.
////////////////////////////////////////////////////////////////////
INLINE bool Thread::
is_simple_threads() {
if (!support_threads) {
return false;
}
return ThreadImpl::is_simple_threads();
}
////////////////////////////////////////////////////////////////////
// Function: Thread::sleep
// Access: Published, Static

View File

@ -80,6 +80,7 @@ PUBLISHED:
INLINE static int get_current_pipeline_stage();
INLINE static bool is_threading_supported();
INLINE static bool is_true_threads();
INLINE static bool is_simple_threads();
BLOCKING INLINE static void sleep(double seconds);
BLOCKING INLINE static void force_yield();

View File

@ -112,6 +112,16 @@ is_true_threads() {
return false;
}
////////////////////////////////////////////////////////////////////
// Function: ThreadDummyImpl::is_simple_threads
// Access: Public, Static
// Description:
////////////////////////////////////////////////////////////////////
INLINE bool ThreadDummyImpl::
is_simple_threads() {
return false;
}
////////////////////////////////////////////////////////////////////
// Function: ThreadDummyImpl::sleep
// Access: Public, Static

View File

@ -54,6 +54,7 @@ public:
INLINE static void bind_thread(Thread *thread);
INLINE static bool is_threading_supported();
INLINE static bool is_true_threads();
INLINE static bool is_simple_threads();
INLINE static void sleep(double seconds);
INLINE static void yield();
INLINE static void consider_yield();

View File

@ -95,6 +95,16 @@ is_true_threads() {
return true;
}
////////////////////////////////////////////////////////////////////
// Function: ThreadPosixImpl::is_simple_threads
// Access: Public, Static
// Description:
////////////////////////////////////////////////////////////////////
INLINE bool ThreadPosixImpl::
is_simple_threads() {
return false;
}
////////////////////////////////////////////////////////////////////
// Function: ThreadPosixImpl::sleep
// Access: Public, Static

View File

@ -50,6 +50,7 @@ public:
INLINE static void bind_thread(Thread *thread);
INLINE static bool is_threading_supported();
INLINE static bool is_true_threads();
INLINE static bool is_simple_threads();
INLINE static void sleep(double seconds);
INLINE static void yield();
INLINE static void consider_yield();

View File

@ -72,6 +72,16 @@ is_true_threads() {
return (is_os_threads != 0);
}
////////////////////////////////////////////////////////////////////
// Function: ThreadSimpleImpl::is_simple_threads
// Access: Public, Static
// Description:
////////////////////////////////////////////////////////////////////
INLINE bool ThreadSimpleImpl::
is_simple_threads() {
return true;
}
////////////////////////////////////////////////////////////////////
// Function: ThreadSimpleImpl::sleep
// Access: Public, Static

View File

@ -78,6 +78,7 @@ public:
INLINE static void bind_thread(Thread *thread);
INLINE static bool is_threading_supported();
INLINE static bool is_true_threads();
INLINE static bool is_simple_threads();
INLINE static void sleep(double seconds);
INLINE static void yield();
INLINE static void consider_yield();

View File

@ -95,6 +95,16 @@ is_true_threads() {
return true;
}
////////////////////////////////////////////////////////////////////
// Function: ThreadWin32Impl::is_simple_threads
// Access: Public, Static
// Description:
////////////////////////////////////////////////////////////////////
INLINE bool ThreadWin32Impl::
is_simple_threads() {
return false;
}
////////////////////////////////////////////////////////////////////
// Function: ThreadWin32Impl::sleep
// Access: Public, Static

View File

@ -49,6 +49,7 @@ public:
INLINE static void bind_thread(Thread *thread);
INLINE static bool is_threading_supported();
INLINE static bool is_true_threads();
INLINE static bool is_simple_threads();
INLINE static void sleep(double seconds);
INLINE static void yield();
INLINE static void consider_yield();