00001 // Filename: threadNsprImpl.I 00002 // Created by: drose (08Aug02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: ThreadNsprImpl::Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE ThreadNsprImpl:: 00026 ThreadNsprImpl(Thread *parent_obj) : 00027 _parent_obj(parent_obj) 00028 { 00029 _thread = (PRThread *)NULL; 00030 _joinable = false; 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: ThreadNsprImpl::prepare_for_exit 00035 // Access: Public 00036 // Description: 00037 //////////////////////////////////////////////////////////////////// 00038 INLINE void ThreadNsprImpl:: 00039 prepare_for_exit() { 00040 PR_Cleanup(); 00041 } 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: ThreadNsprImpl::Constructor 00045 // Access: Public, Static 00046 // Description: 00047 //////////////////////////////////////////////////////////////////// 00048 INLINE Thread *ThreadNsprImpl:: 00049 get_current_thread() { 00050 if (!_got_pt_ptr_index) { 00051 return (Thread *)NULL; 00052 } 00053 return (Thread *)PR_GetThreadPrivate(_pt_ptr_index); 00054 } 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function: ThreadNsprImpl::is_threading_supported 00058 // Access: Public, Static 00059 // Description: 00060 //////////////////////////////////////////////////////////////////// 00061 INLINE bool ThreadNsprImpl:: 00062 is_threading_supported() { 00063 return true; 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function: ThreadNsprImpl::sleep 00068 // Access: Public, Static 00069 // Description: 00070 //////////////////////////////////////////////////////////////////// 00071 INLINE void ThreadNsprImpl:: 00072 sleep(double seconds) { 00073 PR_Sleep((int)(PR_TicksPerSecond() * seconds)); 00074 }