Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/express/threadNsprImpl.h

Go to the documentation of this file.
00001 // Filename: threadNsprImpl.h
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 #ifndef THREADNSPRIMPL_H
00020 #define THREADNSPRIMPL_H
00021 
00022 #include "pandabase.h"
00023 #include "selectThreadImpl.h"
00024 
00025 #ifdef THREAD_NSPR_IMPL
00026 
00027 #include "notify.h"
00028 #include "threadPriority.h"
00029 #include "pmutex.h"
00030 
00031 #include <prthread.h>
00032 #include <prinit.h>
00033 
00034 class Thread;
00035 
00036 ////////////////////////////////////////////////////////////////////
00037 //       Class : ThreadNsprImpl
00038 // Description : Uses NSPR to implement a thread.
00039 ////////////////////////////////////////////////////////////////////
00040 class EXPCL_PANDAEXPRESS ThreadNsprImpl {
00041 public:
00042   INLINE ThreadNsprImpl(Thread *parent_obj);
00043   INLINE ~ThreadNsprImpl();
00044 
00045   bool start(ThreadPriority priority, bool global, bool joinable);
00046   void join();
00047 
00048   INLINE static void prepare_for_exit();
00049 
00050   INLINE static Thread *get_current_thread();
00051   INLINE static bool is_threading_supported();
00052   INLINE static void sleep(double seconds);
00053 
00054 private:
00055   static void root_func(void *data);
00056   static void pt_ptr_destructor(void *data);
00057 
00058   Mutex _mutex;
00059   Thread *_parent_obj;
00060   PRThread *_thread;
00061   bool _joinable;
00062   static PRUintn _pt_ptr_index;
00063   static bool _got_pt_ptr_index;
00064 };
00065 
00066 #include "threadNsprImpl.I"
00067 
00068 #endif  // THREAD_NSPR_IMPL
00069 
00070 #endif

Generated on Fri May 2 00:38:41 2003 for Panda by doxygen1.3