00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
00038
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