Panda3D
threadDummyImpl.I
1 // Filename: threadDummyImpl.I
2 // Created by: drose (09Aug02)
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: ThreadDummyImpl::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE ThreadDummyImpl::
22 ThreadDummyImpl(Thread *) {
23 }
24 
25 ////////////////////////////////////////////////////////////////////
26 // Function: ThreadDummyImpl::Destructor
27 // Access: Public
28 // Description:
29 ////////////////////////////////////////////////////////////////////
30 INLINE ThreadDummyImpl::
31 ~ThreadDummyImpl() {
32 }
33 
34 ////////////////////////////////////////////////////////////////////
35 // Function: ThreadDummyImpl::setup_main_thread
36 // Access: Public
37 // Description: Called for the main thread only, which has been
38 // already started, to fill in the values appropriate to
39 // that thread.
40 ////////////////////////////////////////////////////////////////////
41 void ThreadDummyImpl::
42 setup_main_thread() {
43 }
44 
45 ////////////////////////////////////////////////////////////////////
46 // Function: ThreadDummyImpl::start
47 // Access: Public
48 // Description:
49 ////////////////////////////////////////////////////////////////////
50 INLINE bool ThreadDummyImpl::
51 start(ThreadPriority, bool) {
52  return false;
53 }
54 
55 ////////////////////////////////////////////////////////////////////
56 // Function: ThreadDummyImpl::join
57 // Access: Public
58 // Description:
59 ////////////////////////////////////////////////////////////////////
60 INLINE void ThreadDummyImpl::
61 join() {
62 }
63 
64 ////////////////////////////////////////////////////////////////////
65 // Function: ThreadDummyImpl::preempt
66 // Access: Public
67 // Description:
68 ////////////////////////////////////////////////////////////////////
69 INLINE void ThreadDummyImpl::
70 preempt() {
71 }
72 
73 ////////////////////////////////////////////////////////////////////
74 // Function: ThreadDummyImpl::prepare_for_exit
75 // Access: Public
76 // Description:
77 ////////////////////////////////////////////////////////////////////
78 INLINE void ThreadDummyImpl::
79 prepare_for_exit() {
80 }
81 
82 ////////////////////////////////////////////////////////////////////
83 // Function: ThreadDummyImpl::bind_thread
84 // Access: Public, Static
85 // Description: Associates the indicated Thread object with the
86 // currently-executing thread. You should not call this
87 // directly; use Thread::bind_thread() instead.
88 ////////////////////////////////////////////////////////////////////
89 INLINE void ThreadDummyImpl::
90 bind_thread(Thread *thread) {
91  // This method shouldn't be called in the non-threaded case.
92  nassertv(false);
93 }
94 
95 ////////////////////////////////////////////////////////////////////
96 // Function: ThreadDummyImpl::is_threading_supported
97 // Access: Public, Static
98 // Description:
99 ////////////////////////////////////////////////////////////////////
100 INLINE bool ThreadDummyImpl::
101 is_threading_supported() {
102  return false;
103 }
104 
105 ////////////////////////////////////////////////////////////////////
106 // Function: ThreadDummyImpl::is_true_threads
107 // Access: Public, Static
108 // Description:
109 ////////////////////////////////////////////////////////////////////
110 INLINE bool ThreadDummyImpl::
111 is_true_threads() {
112  return false;
113 }
114 
115 ////////////////////////////////////////////////////////////////////
116 // Function: ThreadDummyImpl::is_simple_threads
117 // Access: Public, Static
118 // Description:
119 ////////////////////////////////////////////////////////////////////
120 INLINE bool ThreadDummyImpl::
121 is_simple_threads() {
122  return false;
123 }
124 
125 ////////////////////////////////////////////////////////////////////
126 // Function: ThreadDummyImpl::sleep
127 // Access: Public, Static
128 // Description:
129 ////////////////////////////////////////////////////////////////////
130 INLINE void ThreadDummyImpl::
131 sleep(double seconds) {
132 #ifdef WIN32
133  Sleep((int)(seconds * 1000));
134 #else
135  struct timespec rqtp;
136  rqtp.tv_sec = time_t(seconds);
137  rqtp.tv_nsec = long((seconds - (double)rqtp.tv_sec) * 1000000000.0);
138  nanosleep(&rqtp, NULL);
139 #endif // WIN32
140 }
141 
142 ////////////////////////////////////////////////////////////////////
143 // Function: ThreadDummyImpl::yield
144 // Access: Public, Static
145 // Description:
146 ////////////////////////////////////////////////////////////////////
147 INLINE void ThreadDummyImpl::
148 yield() {
149 }
150 
151 ////////////////////////////////////////////////////////////////////
152 // Function: ThreadDummyImpl::consider_yield
153 // Access: Public, Static
154 // Description:
155 ////////////////////////////////////////////////////////////////////
156 INLINE void ThreadDummyImpl::
157 consider_yield() {
158 }
A thread; that is, a lightweight process.
Definition: thread.h:51