Panda3D
threadWin32Impl.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 threadWin32Impl.I
10  * @author drose
11  * @date 2006-02-07
12  */
13 
14 /**
15  *
16  */
17 INLINE ThreadWin32Impl::
18 ThreadWin32Impl(Thread *parent_obj) :
19  _cv(_mutex),
20  _parent_obj(parent_obj)
21 {
22  _thread = 0;
23  _joinable = false;
24  _status = S_new;
25 }
26 
27 /**
28  *
29  */
30 INLINE void ThreadWin32Impl::
31 preempt() {
32 }
33 
34 /**
35  *
36  */
37 INLINE void ThreadWin32Impl::
38 prepare_for_exit() {
39 }
40 
41 /**
42  *
43  */
44 INLINE Thread *ThreadWin32Impl::
45 get_current_thread() {
46  if (!_got_pt_ptr_index) {
47  init_pt_ptr_index();
48  }
49  return (Thread *)TlsGetValue(_pt_ptr_index);
50 }
51 
52 /**
53  * Associates the indicated Thread object with the currently-executing thread.
54  * You should not call this directly; use Thread::bind_thread() instead.
55  */
56 INLINE void ThreadWin32Impl::
57 bind_thread(Thread *thread) {
58  if (!_got_pt_ptr_index) {
59  init_pt_ptr_index();
60  }
61  BOOL result = TlsSetValue(_pt_ptr_index, thread);
62  nassertv(result);
63 }
64 
65 /**
66  *
67  */
68 INLINE bool ThreadWin32Impl::
69 is_threading_supported() {
70  return true;
71 }
72 
73 /**
74  *
75  */
76 INLINE bool ThreadWin32Impl::
77 is_true_threads() {
78  return true;
79 }
80 
81 /**
82  *
83  */
84 INLINE bool ThreadWin32Impl::
85 is_simple_threads() {
86  return false;
87 }
88 
89 /**
90  *
91  */
92 INLINE void ThreadWin32Impl::
93 sleep(double seconds) {
94  Sleep((int)(seconds * 1000));
95 }
96 
97 /**
98  *
99  */
100 INLINE void ThreadWin32Impl::
101 yield() {
102  Sleep(1);
103 }
104 
105 /**
106  *
107  */
108 INLINE void ThreadWin32Impl::
109 consider_yield() {
110 }
A thread; that is, a lightweight process.
Definition: thread.h:46