Panda3D
Loading...
Searching...
No Matches
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 */
17INLINE ThreadWin32Impl::
18ThreadWin32Impl(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 */
30INLINE void ThreadWin32Impl::
31preempt() {
32}
33
34/**
35 *
36 */
37INLINE void ThreadWin32Impl::
38prepare_for_exit() {
39}
40
41/**
42 *
43 */
44INLINE Thread *ThreadWin32Impl::
45get_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 */
56INLINE void ThreadWin32Impl::
57bind_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 */
68INLINE bool ThreadWin32Impl::
69is_threading_supported() {
70 return true;
71}
72
73/**
74 *
75 */
76INLINE bool ThreadWin32Impl::
77is_true_threads() {
78 return true;
79}
80
81/**
82 *
83 */
84INLINE bool ThreadWin32Impl::
85is_simple_threads() {
86 return false;
87}
88
89/**
90 *
91 */
92INLINE void ThreadWin32Impl::
93sleep(double seconds) {
94 Sleep((int)(seconds * 1000));
95}
96
97/**
98 *
99 */
100INLINE void ThreadWin32Impl::
101yield() {
102 Sleep(1);
103}
104
105/**
106 *
107 */
108INLINE void ThreadWin32Impl::
109consider_yield() {
110}
A thread; that is, a lightweight process.
Definition thread.h:46