00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef CU_TSTATE_H
00019 #define CU_TSTATE_H
00020
00021 #include <cu/fwd.h>
00022 #include <cu/conf.h>
00023 #include <cu/threadlocal.h>
00024 #ifdef CUCONF_HAVE_GC_GC_TINY_FL_H
00025 # include <gc/gc_tiny_fl.h>
00026 #endif
00027 #include <pthread.h>
00028 #include <iconv.h>
00029 #include <atomic_ops.h>
00030
00031 CU_BEGIN_DECLARATIONS
00032
00033
00034
00035 #if defined(GC_TINY_FREELISTS) && defined(GC_GRANULE_BYTES)
00036 # define CU_GRAN_SIZE GC_GRANULE_BYTES
00037 # define cuP_FL_CNT GC_TINY_FREELISTS
00038 #elif CUCONF_SIZEOF_VOID_P == 4
00039 # define CU_GRAN_SIZE 8
00040 # define cuP_FL_CNT 64
00041 #elif CUCONF_SIZEOF_VOID_P == 8
00042 # define CU_GRAN_SIZE 16
00043 # define cuP_FL_CNT 48
00044 #endif
00045 #define CU_GRAN_SIZEW (CU_GRAN_SIZE/CU_WORD_SIZE)
00046
00047 typedef enum {
00048 cu_memkind_normal,
00049 cu_memkind_atomic,
00050 cu_memkind_uncoll,
00051 cu_memkind_atomic_uncoll,
00052 cu_memkind_object,
00053 cu_memkind_cnt
00054 } cu_memkind_t;
00055
00056 typedef AO_t cu_rarex_t;
00057
00058 typedef struct cuP_tstate *cuP_tstate_t;
00059 struct cuP_tstate
00060 {
00061 cuP_tstate_t next;
00062
00063
00064 struct cuP_thread_atexit_node *atexit_chain;
00065 void *ord_fl_arr[cuP_FL_CNT];
00066 void *unord_fl_arr[cuP_FL_CNT];
00067 cu_rarex_t *jammed_on_rarex;
00068 cu_bool_t jammed_on_write;
00069
00070
00071 struct cuflowP_windstate *windstate;
00072 int priority;
00073 void *gflexq;
00074
00075
00076 iconv_t iconv_utf8_to_ucs4;
00077 iconv_t iconv_ucs4_to_utf8;
00078 };
00079
00080 extern pthread_mutex_t cuP_global_mutex;
00081 extern cuP_tstate_t cuP_tstate_chain;
00082
00083 CU_THREADLOCAL_DECL(cuP_tstate, cuP_tstate);
00084 #define cuP_tstate_glck cuP_tstate
00085
00086 CU_END_DECLARATIONS
00087
00088 #endif