Panda3D
threadDummyImpl.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file threadDummyImpl.I
10  * @author drose
11  * @date 2002-08-09
12  */
13 
14 /**
15  *
16  */
17 INLINE ThreadDummyImpl::
18 ThreadDummyImpl(Thread *) {
19 }
20 
21 /**
22  *
23  */
24 INLINE ThreadDummyImpl::
25 ~ThreadDummyImpl() {
26 }
27 
28 /**
29  * Called for the main thread only, which has been already started, to fill in
30  * the values appropriate to that thread.
31  */
32 void ThreadDummyImpl::
33 setup_main_thread() {
34 }
35 
36 /**
37  *
38  */
39 INLINE bool ThreadDummyImpl::
40 start(ThreadPriority, bool) {
41  return false;
42 }
43 
44 /**
45  *
46  */
47 INLINE void ThreadDummyImpl::
48 join() {
49 }
50 
51 /**
52  *
53  */
54 INLINE void ThreadDummyImpl::
55 preempt() {
56 }
57 
58 /**
59  *
60  */
61 INLINE void ThreadDummyImpl::
62 prepare_for_exit() {
63 }
64 
65 /**
66  * Associates the indicated Thread object with the currently-executing thread.
67  * You should not call this directly; use Thread::bind_thread() instead.
68  */
69 INLINE void ThreadDummyImpl::
70 bind_thread(Thread *thread) {
71  // This method shouldn't be called in the non-threaded case.
72  nassertv(false);
73 }
74 
75 /**
76  *
77  */
78 INLINE bool ThreadDummyImpl::
79 is_threading_supported() {
80  return false;
81 }
82 
83 /**
84  *
85  */
86 INLINE bool ThreadDummyImpl::
87 is_true_threads() {
88  return false;
89 }
90 
91 /**
92  *
93  */
94 INLINE bool ThreadDummyImpl::
95 is_simple_threads() {
96  return false;
97 }
98 
99 /**
100  *
101  */
102 INLINE void ThreadDummyImpl::
103 sleep(double seconds) {
104 #ifdef WIN32
105  Sleep((int)(seconds * 1000));
106 #else
107  struct timespec rqtp;
108  rqtp.tv_sec = time_t(seconds);
109  rqtp.tv_nsec = long((seconds - (double)rqtp.tv_sec) * 1000000000.0);
110  nanosleep(&rqtp, nullptr);
111 #endif // WIN32
112 }
113 
114 /**
115  *
116  */
117 INLINE void ThreadDummyImpl::
118 yield() {
119 }
120 
121 /**
122  *
123  */
124 INLINE void ThreadDummyImpl::
125 consider_yield() {
126 }
A thread; that is, a lightweight process.
Definition: thread.h:46