Panda3D
threadDummyImpl.h
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.h
10  * @author drose
11  * @date 2002-08-09
12  */
13 
14 #ifndef THREADDUMMYIMPL_H
15 #define THREADDUMMYIMPL_H
16 
17 #include "pandabase.h"
18 #include "selectThreadImpl.h"
19 
20 #ifdef THREAD_DUMMY_IMPL
21 
22 #include "pnotify.h"
23 #include "threadPriority.h"
24 
25 class Thread;
26 
27 #ifdef WIN32
28 #ifndef WIN32_LEAN_AND_MEAN
29 #define WIN32_LEAN_AND_MEAN 1
30 #endif
31 #include <windows.h> // For Sleep().
32 #endif
33 
34 /**
35  * A fake thread implementation for single-threaded applications. This simply
36  * fails whenever you try to start a thread.
37  */
38 class EXPCL_PANDA_PIPELINE ThreadDummyImpl {
39 public:
40  INLINE ThreadDummyImpl(Thread *parent_obj);
41  INLINE ~ThreadDummyImpl();
42 
43  INLINE void setup_main_thread();
44  INLINE bool start(ThreadPriority priority, bool joinable);
45  INLINE void join();
46  INLINE void preempt();
47 
48  std::string get_unique_id() const;
49 
50  INLINE static void prepare_for_exit();
51 
52  static Thread *get_current_thread();
53  INLINE static void bind_thread(Thread *thread);
54  INLINE static bool is_threading_supported();
55  INLINE static bool is_true_threads();
56  INLINE static bool is_simple_threads();
57  INLINE static void sleep(double seconds);
58  INLINE static void yield();
59  INLINE static void consider_yield();
60 };
61 
62 #include "threadDummyImpl.I"
63 
64 #endif // THREAD_DUMMY_IMPL
65 
66 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A thread; that is, a lightweight process.
Definition: thread.h:46