Panda3D
threadDummyImpl.cxx
1 // Filename: threadDummyImpl.cxx
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 #include "selectThreadImpl.h"
16 
17 #ifdef THREAD_DUMMY_IMPL
18 
19 #include "threadDummyImpl.h"
20 #include "thread.h"
21 
22 #ifdef WIN32
23 #define WIN32_LEAN_AND_MEAN 1
24 #include <windows.h>
25 #endif
26 
27 ////////////////////////////////////////////////////////////////////
28 // Function: ThreadDummyImpl::get_unique_id
29 // Access: Public
30 // Description:
31 ////////////////////////////////////////////////////////////////////
32 string ThreadDummyImpl::
33 get_unique_id() const {
34  // In a single-threaded application, this is just the unique process
35  // ID.
36  ostringstream strm;
37 #ifdef WIN32
38  strm << GetCurrentProcessId();
39 #else
40  strm << getpid();
41 #endif
42  return strm.str();
43 }
44 
45 ////////////////////////////////////////////////////////////////////
46 // Function: ThreadDummyImpl::get_current_thread
47 // Access: Public
48 // Description:
49 ////////////////////////////////////////////////////////////////////
50 Thread *ThreadDummyImpl::
51 get_current_thread() {
52  return Thread::get_main_thread();
53 }
54 
55 #endif // THREAD_DUMMY_IMPL
static Thread * get_main_thread()
Returns a pointer to the "main" Thread object–this is the Thread that started the whole process...
Definition: thread.I:107
A thread; that is, a lightweight process.
Definition: thread.h:51