Panda3D
 All Classes Functions Variables Enumerations
threadSimpleManager.I
1 // Filename: threadSimpleManager.I
2 // Created by: drose (19Jun07)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: ThreadSimpleManager::get_current_thread
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE ThreadSimpleImpl *ThreadSimpleManager::
22 get_current_thread() {
23  return _current_thread;
24 }
25 
26 ////////////////////////////////////////////////////////////////////
27 // Function: ThreadSimpleManager::is_same_system_thread
28 // Access: Public
29 // Description: Returns true if we are still running within the same
30 // OS-level thread we think we should be running in, or
31 // false if this appears to be running in a different
32 // thread.
33 ////////////////////////////////////////////////////////////////////
34 INLINE bool ThreadSimpleManager::
35 is_same_system_thread() const {
36  return _current_thread->is_same_system_thread();
37 }
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function: ThreadSimpleManager::get_global_ptr
41 // Access: Public, Static
42 // Description:
43 ////////////////////////////////////////////////////////////////////
44 INLINE ThreadSimpleManager *ThreadSimpleManager::
45 get_global_ptr() {
46  if (!_pointers_initialized) {
47  init_pointers();
48  }
49  return _global_ptr;
50 }
51 
52 ////////////////////////////////////////////////////////////////////
53 // Function: ThreadSimpleManager::CompareStartTime::operator()
54 // Access: Public
55 // Description: STL function object to sort the priority queue of
56 // sleeping threads.
57 ////////////////////////////////////////////////////////////////////
58 INLINE bool ThreadSimpleManager::CompareStartTime::
59 operator ()(ThreadSimpleImpl *a, ThreadSimpleImpl *b) const {
60  return a->get_wake_time() > b->get_wake_time();
61 }