base_thread_common.hh

Go to the documentation of this file.
00001 /*
00008  * LEGAL:   COPYRIGHT (C) 2007 JIM E. BROOKS
00009  *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
00010  *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
00011  *****************************************************************************/
00012 
00013 #if COMPILE_THREADS
00014 #ifndef BASE_THREAD_COMMON_HH
00015 #define BASE_THREAD_COMMON_HH 1
00016 
00017 
00018 
00019 #include "base_assert.hh"
00020 #include "base_typesig.hh"
00021 
00022 // Call a pthread function and assert return value.
00023 // Most POSIX pthread functions return 0 if successful.
00024 // Eg: PTHREAD_CALL( pthread_create(..) );   // semicolon outside last parenthesis
00025 #if DEBUG
00026 #define PTHREAD_CALL( CALL ) ASSERT_UNLESS_EXITING( ((CALL) == 0) )
00027 #else
00028 #define PTHREAD_CALL( CALL ) CALL
00029 #endif
00030 
00031 // Limited-use (solves compiling dep).  Use Thread::Yield() instead.
00032 #if OS_DARWIN || OS_CYGWIN
00033 #define THREAD_YIELD sched_yield
00034 #else
00035 #define THREAD_YIELD pthread_yield
00036 #endif
00037 
00038 #endif // BASE_THREAD_COMMON_HH
00039 #endif // COMPILE_THREADS
Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:07 2007