Commit 31f93140 authored by Shane Snyder's avatar Shane Snyder

bug fix in previous commit

we need to remember whether a sleeping thread is in the same pool
as the progress thread to properly decrement the number of
waiting ULTS.
parent 8e6a215a
...@@ -483,7 +483,8 @@ typedef struct ...@@ -483,7 +483,8 @@ typedef struct
margo_instance_id mid; margo_instance_id mid;
ABT_mutex mutex; ABT_mutex mutex;
ABT_cond cond; ABT_cond cond;
int is_asleep; char is_asleep;
char in_pool;
} margo_thread_sleep_cb_dat; } margo_thread_sleep_cb_dat;
static void margo_thread_sleep_cb(void *arg) static void margo_thread_sleep_cb(void *arg)
...@@ -493,7 +494,8 @@ static void margo_thread_sleep_cb(void *arg) ...@@ -493,7 +494,8 @@ static void margo_thread_sleep_cb(void *arg)
/* decrement number of waiting threads */ /* decrement number of waiting threads */
ABT_mutex_lock(sleep_cb_dat->mid->finalize_mutex); ABT_mutex_lock(sleep_cb_dat->mid->finalize_mutex);
sleep_cb_dat->mid->finalize_waiters_in_progress_pool--; sleep_cb_dat->mid->finalize_waiters_in_progress_pool -=
sleep_cb_dat->in_pool;
ABT_mutex_unlock(sleep_cb_dat->mid->finalize_mutex); ABT_mutex_unlock(sleep_cb_dat->mid->finalize_mutex);
/* wake up the sleeping thread */ /* wake up the sleeping thread */
...@@ -513,19 +515,20 @@ void margo_thread_sleep( ...@@ -513,19 +515,20 @@ void margo_thread_sleep(
margo_timer_t sleep_timer; margo_timer_t sleep_timer;
margo_thread_sleep_cb_dat sleep_cb_dat; margo_thread_sleep_cb_dat sleep_cb_dat;
if(margo_xstream_is_in_progress_pool(mid))
in_pool = 1;
/* set data needed for sleep callback */ /* set data needed for sleep callback */
sleep_cb_dat.mid = mid; sleep_cb_dat.mid = mid;
ABT_mutex_create(&(sleep_cb_dat.mutex)); ABT_mutex_create(&(sleep_cb_dat.mutex));
ABT_cond_create(&(sleep_cb_dat.cond)); ABT_cond_create(&(sleep_cb_dat.cond));
sleep_cb_dat.is_asleep = 1; sleep_cb_dat.is_asleep = 1;
sleep_cb_dat.in_pool = in_pool;
/* initialize the sleep timer */ /* initialize the sleep timer */
margo_timer_init(mid, &sleep_timer, margo_thread_sleep_cb, margo_timer_init(mid, &sleep_timer, margo_thread_sleep_cb,
&sleep_cb_dat, timeout_ms); &sleep_cb_dat, timeout_ms);
if(margo_xstream_is_in_progress_pool(mid))
in_pool = 1;
/* increment number of waiting threads */ /* increment number of waiting threads */
ABT_mutex_lock(mid->finalize_mutex); ABT_mutex_lock(mid->finalize_mutex);
mid->finalize_waiters_in_progress_pool += in_pool; mid->finalize_waiters_in_progress_pool += in_pool;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment