00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00018 #ifndef LIBCWD_PRIVATE_THREAD_H
00019 #define LIBCWD_PRIVATE_THREAD_H
00020
00021 #ifndef LIBCWD_PRIVATE_MUTEX_H
00022 #include <libcwd/private_mutex.h>
00023 #endif
00024 #ifndef LIBCWD_PRIVATE_ALLOCATOR_H
00025 #include <libcwd/private_allocator.h>
00026 #endif
00027 #ifndef LIBCW_LIST
00028 #define LIBCW_LIST
00029 #include <list>
00030 #endif
00031
00032 namespace libcwd {
00033
00034 class dm_alloc_ct;
00035
00036 namespace _private_ {
00037
00038 struct TSD_st;
00039
00040
00041
00042
00043
00044
00045
00046
00047 class thread_ct {
00048
00049 public:
00050 #if CWDEBUG_ALLOC
00051 typedef std::list<thread_ct, internal_allocator::rebind<thread_ct>::other> threadlist_type;
00052 #else
00053 typedef std::list<thread_ct> threadlist_type;
00054 #endif
00055
00056 public:
00057 mutex_ct thread_mutex;
00058 #if CWDEBUG_ALLOC
00059 void* memblk_map;
00060 dm_alloc_ct* base_alloc_list;
00061 dm_alloc_ct** current_alloc_list;
00062 dm_alloc_ct* current_owner_node;
00063
00064 size_t memsize;
00065 unsigned long memblks;
00066 #endif
00067 pthread_t tid;
00068
00069 bool M_zombie;
00070 bool M_terminating;
00071
00072 void initialize(LIBCWD_TSD_PARAM);
00073 void terminated(threadlist_type::iterator LIBCWD_COMMA_TSD_PARAM);
00074 bool is_zombie(void) const { return M_zombie; }
00075 void terminating(void) { M_terminating = true; }
00076 bool is_terminating(void) const { return M_terminating; }
00077 };
00078
00079
00080
00081 typedef thread_ct::threadlist_type threadlist_t;
00082 extern threadlist_t* threadlist;
00083
00084 }
00085 }
00086
00087 #endif // LIBCWD_PRIVATE_THREAD_H
00088