6 #ifndef ABTD_H_INCLUDED 7 #define ABTD_H_INCLUDED 16 ABTD_XSTREAM_CONTEXT_STATE_RUNNING,
17 ABTD_XSTREAM_CONTEXT_STATE_WAITING,
18 ABTD_XSTREAM_CONTEXT_STATE_REQ_JOIN,
19 ABTD_XSTREAM_CONTEXT_STATE_REQ_TERMINATE,
20 } ABTD_xstream_context_state;
21 typedef struct ABTD_xstream_context {
22 pthread_t native_thread;
23 void *(*thread_f)(
void *);
25 ABTD_xstream_context_state state;
26 pthread_mutex_t state_lock;
27 pthread_cond_t state_cond;
28 } ABTD_xstream_context;
29 typedef pthread_mutex_t ABTD_xstream_mutex;
30 #ifdef HAVE_PTHREAD_BARRIER_INIT 31 typedef pthread_barrier_t ABTD_xstream_barrier;
33 typedef void *ABTD_xstream_barrier;
37 #define ABTD_XSTREAM_LOCAL __thread 40 void ABTD_env_init(ABTI_global *p_global);
43 int ABTD_xstream_context_create(
void *(*f_xstream)(
void *),
void *p_arg,
44 ABTD_xstream_context *p_ctx);
45 int ABTD_xstream_context_free(ABTD_xstream_context *p_ctx);
46 int ABTD_xstream_context_join(ABTD_xstream_context *p_ctx);
47 int ABTD_xstream_context_revive(ABTD_xstream_context *p_ctx);
48 int ABTD_xstream_context_set_self(ABTD_xstream_context *p_ctx);
51 void ABTD_affinity_init(
void);
52 void ABTD_affinity_finalize(
void);
53 int ABTD_affinity_set(ABTD_xstream_context *p_ctx,
int rank);
54 int ABTD_affinity_set_cpuset(ABTD_xstream_context *p_ctx,
int cpuset_size,
56 int ABTD_affinity_get_cpuset(ABTD_xstream_context *p_ctx,
int cpuset_size,
57 int *p_cpuset,
int *p_num_cpus);
63 void ABTD_thread_exit(ABTI_local *p_local, ABTI_thread *p_thread);
64 void ABTD_thread_cancel(ABTI_local *p_local, ABTI_thread *p_thread);
66 #if defined(ABT_CONFIG_USE_CLOCK_GETTIME) 68 typedef struct timespec ABTD_time;
70 #elif defined(ABT_CONFIG_USE_MACH_ABSOLUTE_TIME) 71 #include <mach/mach_time.h> 72 typedef uint64_t ABTD_time;
74 #elif defined(ABT_CONFIG_USE_GETTIMEOFDAY) 76 typedef struct timeval ABTD_time;
80 void ABTD_time_init(
void);
81 int ABTD_time_get(ABTD_time *p_time);
82 double ABTD_time_read_sec(ABTD_time *p_time);