Panda3D
Loading...
Searching...
No Matches
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 */
17INLINE ThreadDummyImpl::
18ThreadDummyImpl(Thread *) {
19}
20
21/**
22 *
23 */
24INLINE 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 */
32void ThreadDummyImpl::
33setup_main_thread() {
34}
35
36/**
37 *
38 */
39INLINE bool ThreadDummyImpl::
40start(ThreadPriority, bool) {
41 return false;
42}
43
44/**
45 *
46 */
47INLINE void ThreadDummyImpl::
48join() {
49}
50
51/**
52 *
53 */
54INLINE void ThreadDummyImpl::
55preempt() {
56}
57
58/**
59 *
60 */
61INLINE void ThreadDummyImpl::
62prepare_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 */
69INLINE void ThreadDummyImpl::
70bind_thread(Thread *thread) {
71 // This method shouldn't be called in the non-threaded case.
72 nassertv(false);
73}
74
75/**
76 *
77 */
78INLINE bool ThreadDummyImpl::
79is_threading_supported() {
80 return false;
81}
82
83/**
84 *
85 */
86INLINE bool ThreadDummyImpl::
87is_true_threads() {
88 return false;
89}
90
91/**
92 *
93 */
94INLINE bool ThreadDummyImpl::
95is_simple_threads() {
96 return false;
97}
98
99/**
100 *
101 */
102INLINE void ThreadDummyImpl::
103sleep(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 */
117INLINE void ThreadDummyImpl::
118yield() {
119}
120
121/**
122 *
123 */
124INLINE void ThreadDummyImpl::
125consider_yield() {
126}
A thread; that is, a lightweight process.
Definition thread.h:46