Panda3D
 All Classes Functions Variables Enumerations
threadWin32Impl.I
00001 // Filename: threadWin32Impl.I
00002 // Created by:  drose (07Feb06)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: ThreadWin32Impl::Constructor
00018 //       Access: Public
00019 //  Description: 
00020 ////////////////////////////////////////////////////////////////////
00021 INLINE ThreadWin32Impl::
00022 ThreadWin32Impl(Thread *parent_obj) :
00023   _cv(_mutex),
00024   _parent_obj(parent_obj)
00025 {
00026   _thread = 0;
00027   _joinable = false;
00028   _status = S_new;
00029 }
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 //     Function: ThreadWin32Impl::preempt
00033 //       Access: Public
00034 //  Description: 
00035 ////////////////////////////////////////////////////////////////////
00036 INLINE void ThreadWin32Impl::
00037 preempt() {
00038 }
00039 
00040 ////////////////////////////////////////////////////////////////////
00041 //     Function: ThreadWin32Impl::prepare_for_exit
00042 //       Access: Public
00043 //  Description: 
00044 ////////////////////////////////////////////////////////////////////
00045 INLINE void ThreadWin32Impl::
00046 prepare_for_exit() {
00047 }
00048 
00049 ////////////////////////////////////////////////////////////////////
00050 //     Function: ThreadWin32Impl::get_current_thread
00051 //       Access: Public, Static
00052 //  Description: 
00053 ////////////////////////////////////////////////////////////////////
00054 INLINE Thread *ThreadWin32Impl::
00055 get_current_thread() {
00056   if (!_got_pt_ptr_index) {
00057     init_pt_ptr_index();
00058   }
00059   return (Thread *)TlsGetValue(_pt_ptr_index);
00060 }
00061 
00062 ////////////////////////////////////////////////////////////////////
00063 //     Function: ThreadWin32Impl::bind_thread
00064 //       Access: Public, Static
00065 //  Description: Associates the indicated Thread object with the
00066 //               currently-executing thread.  You should not call this
00067 //               directly; use Thread::bind_thread() instead.
00068 ////////////////////////////////////////////////////////////////////
00069 INLINE void ThreadWin32Impl::
00070 bind_thread(Thread *thread) {
00071   if (!_got_pt_ptr_index) {
00072     init_pt_ptr_index();
00073   }
00074   BOOL result = TlsSetValue(_pt_ptr_index, thread);
00075   nassertv(result);
00076 }
00077 
00078 ////////////////////////////////////////////////////////////////////
00079 //     Function: ThreadWin32Impl::is_threading_supported
00080 //       Access: Public, Static
00081 //  Description: 
00082 ////////////////////////////////////////////////////////////////////
00083 INLINE bool ThreadWin32Impl::
00084 is_threading_supported() {
00085   return true;
00086 }
00087 
00088 ////////////////////////////////////////////////////////////////////
00089 //     Function: ThreadWin32Impl::is_true_threads
00090 //       Access: Public, Static
00091 //  Description: 
00092 ////////////////////////////////////////////////////////////////////
00093 INLINE bool ThreadWin32Impl::
00094 is_true_threads() {
00095   return true;
00096 }
00097 
00098 ////////////////////////////////////////////////////////////////////
00099 //     Function: ThreadWin32Impl::is_simple_threads
00100 //       Access: Public, Static
00101 //  Description: 
00102 ////////////////////////////////////////////////////////////////////
00103 INLINE bool ThreadWin32Impl::
00104 is_simple_threads() {
00105   return false;
00106 }
00107 
00108 ////////////////////////////////////////////////////////////////////
00109 //     Function: ThreadWin32Impl::sleep
00110 //       Access: Public, Static
00111 //  Description: 
00112 ////////////////////////////////////////////////////////////////////
00113 INLINE void ThreadWin32Impl::
00114 sleep(double seconds) {
00115   Sleep((int)(seconds * 1000));
00116 }
00117 
00118 ////////////////////////////////////////////////////////////////////
00119 //     Function: ThreadWin32Impl::yield
00120 //       Access: Public, Static
00121 //  Description: 
00122 ////////////////////////////////////////////////////////////////////
00123 INLINE void ThreadWin32Impl::
00124 yield() {
00125   sleep(0.0);
00126 }
00127 
00128 ////////////////////////////////////////////////////////////////////
00129 //     Function: ThreadWin32Impl::consider_yield
00130 //       Access: Public, Static
00131 //  Description: 
00132 ////////////////////////////////////////////////////////////////////
00133 INLINE void ThreadWin32Impl::
00134 consider_yield() {
00135 }
 All Classes Functions Variables Enumerations