00001 // Filename: threadSimpleManager.I 00002 // Created by: drose (19Jun07) 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: ThreadSimpleManager::get_current_thread 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE ThreadSimpleImpl *ThreadSimpleManager:: 00022 get_current_thread() { 00023 return _current_thread; 00024 } 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Function: ThreadSimpleManager::is_same_system_thread 00028 // Access: Public 00029 // Description: Returns true if we are still running within the same 00030 // OS-level thread we think we should be running in, or 00031 // false if this appears to be running in a different 00032 // thread. 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE bool ThreadSimpleManager:: 00035 is_same_system_thread() const { 00036 return _current_thread->is_same_system_thread(); 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function: ThreadSimpleManager::get_global_ptr 00041 // Access: Public, Static 00042 // Description: 00043 //////////////////////////////////////////////////////////////////// 00044 INLINE ThreadSimpleManager *ThreadSimpleManager:: 00045 get_global_ptr() { 00046 if (!_pointers_initialized) { 00047 init_pointers(); 00048 } 00049 return _global_ptr; 00050 } 00051 00052 //////////////////////////////////////////////////////////////////// 00053 // Function: ThreadSimpleManager::CompareStartTime::operator() 00054 // Access: Public 00055 // Description: STL function object to sort the priority queue of 00056 // sleeping threads. 00057 //////////////////////////////////////////////////////////////////// 00058 INLINE bool ThreadSimpleManager::CompareStartTime:: 00059 operator ()(ThreadSimpleImpl *a, ThreadSimpleImpl *b) const { 00060 return a->get_wake_time() > b->get_wake_time(); 00061 }