17 #if defined(HAVE_LH_LOCK_H)
18 lh_lock_init(&p_htable->mutex);
19 #elif defined(HAVE_CLH_H)
20 clh_init(&p_htable->mutex);
21 #elif defined(USE_PTHREAD_MUTEX)
22 int ret = pthread_mutex_init(&p_htable->mutex, NULL);
28 p_htable->num_rows = num_rows;
30 memset(p_htable->queue, 0, q_size);
31 p_htable->h_list = NULL;
32 p_htable->l_list = NULL;
41 #if defined(HAVE_LH_LOCK_H)
42 lh_lock_destroy(&p_htable->
mutex);
43 #elif defined(HAVE_CLH_H)
44 clh_destroy(&p_htable->
mutex);
45 #elif defined(USE_PTHREAD_MUTEX)
46 int ret = pthread_mutex_destroy(&p_htable->
mutex);
65 uint32_t cur_size, new_size;
67 new_size = (idx / cur_size + 1) * cur_size;
71 memset(&p_htable->
queue[cur_size], 0,
78 p_queue = &p_htable->
queue[idx];
80 if (p_queue->
head == NULL) {
81 p_queue->
head = p_thread;
82 p_queue->
tail = p_thread;
85 p_queue->
tail = p_thread;
99 p_queue = &p_htable->
queue[idx];
102 if (p_queue->
head == NULL) {
111 p_queue->
tail = p_thread;
129 uint32_t cur_size, new_size;
131 new_size = (idx / cur_size + 1) * cur_size;
135 memset(&p_htable->
queue[cur_size], 0,
142 p_queue = &p_htable->
queue[idx];
163 p_queue = &p_htable->
queue[idx];
191 p_thread = p_queue->
head;
192 if (p_queue->
head == p_queue->
tail) {
193 p_queue->
head = NULL;
194 p_queue->
tail = NULL;
248 sync_event_type, p_sync);
267 p_local_xstream ? p_local_xstream->
p_unit
static void ABTI_thread_queue_acquire_low_mutex(ABTI_thread_queue *p_queue)
struct ABTI_thread_queue ABTI_thread_queue
#define ABTU_unreachable()
static void ABTD_atomic_release_store_int(ABTD_atomic_int *ptr, int val)
void ABTI_thread_htable_push(ABTI_thread_htable *p_htable, int idx, ABTI_thread *p_thread)
int ABTI_thread_set_blocked(ABTI_thread *p_thread)
static void * ABTU_malloc(size_t size)
static void ABTI_spinlock_clear(ABTI_spinlock *p_lock)
static void ABTI_thread_queue_release_mutex(ABTI_thread_queue *p_queue)
ABT_unit_id ABTI_thread_get_id(ABTI_thread *p_thread)
static uint32_t ABTD_atomic_fetch_add_uint32(ABTD_atomic_uint32 *ptr, uint32_t v)
ABT_bool ABTI_thread_htable_add_low(ABTI_thread_htable *p_htable, int idx, ABTI_thread *p_thread)
static void ABTI_thread_queue_acquire_mutex(ABTI_thread_queue *p_queue)
static ABTI_thread * ABTI_unit_get_thread(ABTI_unit *p_unit)
static void * ABTU_realloc(void *ptr, size_t old_size, size_t new_size)
static ABTI_thread * ABTI_thread_context_switch_to_sibling(ABTI_xstream **pp_local_xstream, ABTI_thread *p_old, ABTI_thread *p_new)
ABTI_thread_queue * queue
static void ABTI_thread_queue_release_low_mutex(ABTI_thread_queue *p_queue)
static void ABTD_atomic_relaxed_store_uint32(ABTD_atomic_uint32 *ptr, uint32_t val)
ABTI_thread * ABTI_thread_htable_pop(ABTI_thread_htable *p_htable, ABTI_thread_queue *p_queue)
ABT_bool ABTI_thread_htable_switch_low(ABTI_xstream **pp_local_xstream, ABTI_thread_queue *p_queue, ABTI_thread *p_thread, ABTI_thread_htable *p_htable, ABT_sync_event_type sync_event_type, void *p_sync)
static uint32_t ABTD_atomic_fetch_sub_uint32(ABTD_atomic_uint32 *ptr, uint32_t v)
static uint32_t ABTD_atomic_relaxed_load_uint32(const ABTD_atomic_uint32 *ptr)
void ABTI_thread_htable_push_low(ABTI_thread_htable *p_htable, int idx, ABTI_thread *p_thread)
#define ABTI_ASSERT(cond)
#define LOG_DEBUG(fmt,...)
void ABTI_thread_htable_free(ABTI_thread_htable *p_htable)
static void * ABTU_memalign(size_t alignment, size_t size)
static void ABTU_free(void *ptr)
ABT_bool ABTI_thread_htable_add(ABTI_thread_htable *p_htable, int idx, ABTI_thread *p_thread)
ABTD_atomic_uint32 num_elems
#define ABTI_STATIC_ASSERT(cond)
ABTI_thread * ABTI_thread_htable_pop_low(ABTI_thread_htable *p_htable, ABTI_thread_queue *p_queue)
ABTI_thread_htable * ABTI_thread_htable_create(uint32_t num_rows)