Panda3D
|
00001 // Filename: threadDummyImpl.I 00002 // Created by: drose (09Aug02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: ThreadDummyImpl::Constructor 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE ThreadDummyImpl:: 00022 ThreadDummyImpl(Thread *) { 00023 } 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Function: ThreadDummyImpl::Destructor 00027 // Access: Public 00028 // Description: 00029 //////////////////////////////////////////////////////////////////// 00030 INLINE ThreadDummyImpl:: 00031 ~ThreadDummyImpl() { 00032 } 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Function: ThreadDummyImpl::setup_main_thread 00036 // Access: Public 00037 // Description: Called for the main thread only, which has been 00038 // already started, to fill in the values appropriate to 00039 // that thread. 00040 //////////////////////////////////////////////////////////////////// 00041 void ThreadDummyImpl:: 00042 setup_main_thread() { 00043 } 00044 00045 //////////////////////////////////////////////////////////////////// 00046 // Function: ThreadDummyImpl::start 00047 // Access: Public 00048 // Description: 00049 //////////////////////////////////////////////////////////////////// 00050 INLINE bool ThreadDummyImpl:: 00051 start(ThreadPriority, bool) { 00052 return false; 00053 } 00054 00055 //////////////////////////////////////////////////////////////////// 00056 // Function: ThreadDummyImpl::join 00057 // Access: Public 00058 // Description: 00059 //////////////////////////////////////////////////////////////////// 00060 INLINE void ThreadDummyImpl:: 00061 join() { 00062 } 00063 00064 //////////////////////////////////////////////////////////////////// 00065 // Function: ThreadDummyImpl::preempt 00066 // Access: Public 00067 // Description: 00068 //////////////////////////////////////////////////////////////////// 00069 INLINE void ThreadDummyImpl:: 00070 preempt() { 00071 } 00072 00073 //////////////////////////////////////////////////////////////////// 00074 // Function: ThreadDummyImpl::prepare_for_exit 00075 // Access: Public 00076 // Description: 00077 //////////////////////////////////////////////////////////////////// 00078 INLINE void ThreadDummyImpl:: 00079 prepare_for_exit() { 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: ThreadDummyImpl::bind_thread 00084 // Access: Public, Static 00085 // Description: Associates the indicated Thread object with the 00086 // currently-executing thread. You should not call this 00087 // directly; use Thread::bind_thread() instead. 00088 //////////////////////////////////////////////////////////////////// 00089 INLINE void ThreadDummyImpl:: 00090 bind_thread(Thread *thread) { 00091 // This method shouldn't be called in the non-threaded case. 00092 nassertv(false); 00093 } 00094 00095 //////////////////////////////////////////////////////////////////// 00096 // Function: ThreadDummyImpl::is_threading_supported 00097 // Access: Public, Static 00098 // Description: 00099 //////////////////////////////////////////////////////////////////// 00100 INLINE bool ThreadDummyImpl:: 00101 is_threading_supported() { 00102 return false; 00103 } 00104 00105 //////////////////////////////////////////////////////////////////// 00106 // Function: ThreadDummyImpl::is_true_threads 00107 // Access: Public, Static 00108 // Description: 00109 //////////////////////////////////////////////////////////////////// 00110 INLINE bool ThreadDummyImpl:: 00111 is_true_threads() { 00112 return false; 00113 } 00114 00115 //////////////////////////////////////////////////////////////////// 00116 // Function: ThreadDummyImpl::is_simple_threads 00117 // Access: Public, Static 00118 // Description: 00119 //////////////////////////////////////////////////////////////////// 00120 INLINE bool ThreadDummyImpl:: 00121 is_simple_threads() { 00122 return false; 00123 } 00124 00125 //////////////////////////////////////////////////////////////////// 00126 // Function: ThreadDummyImpl::sleep 00127 // Access: Public, Static 00128 // Description: 00129 //////////////////////////////////////////////////////////////////// 00130 INLINE void ThreadDummyImpl:: 00131 sleep(double seconds) { 00132 #ifdef WIN32 00133 Sleep((int)(seconds * 1000)); 00134 #else 00135 struct timespec rqtp; 00136 rqtp.tv_sec = time_t(seconds); 00137 rqtp.tv_nsec = long((seconds - (double)rqtp.tv_sec) * 1000000000.0); 00138 nanosleep(&rqtp, NULL); 00139 #endif // WIN32 00140 } 00141 00142 //////////////////////////////////////////////////////////////////// 00143 // Function: ThreadDummyImpl::yield 00144 // Access: Public, Static 00145 // Description: 00146 //////////////////////////////////////////////////////////////////// 00147 INLINE void ThreadDummyImpl:: 00148 yield() { 00149 } 00150 00151 //////////////////////////////////////////////////////////////////// 00152 // Function: ThreadDummyImpl::consider_yield 00153 // Access: Public, Static 00154 // Description: 00155 //////////////////////////////////////////////////////////////////// 00156 INLINE void ThreadDummyImpl:: 00157 consider_yield() { 00158 }