diff --git a/examples/sleep.c b/examples/sleep.c index 71dadefc94bd123ddfec51c1075b0e105b028043..2e7a7785b1f31db193c64ab52ed96e9ec689fb13 100644 --- a/examples/sleep.c +++ b/examples/sleep.c @@ -100,10 +100,9 @@ int main(int argc, char **argv) } /* actually start margo */ - /* use a single pool for progress and sleeper threads */ - /* NOTE: no rpc handler threads are needed */ + /* use a single pool for progress, sleeper, and handler threads */ /***************************************/ - mid = margo_init(pool, ABT_POOL_NULL, hg_context, hg_class); + mid = margo_init(pool, pool, hg_context, hg_class); for(i=0; i<4; i++) { t_ids[i] = i; diff --git a/src/margo-timer.c b/src/margo-timer.c index c07b73b6b6ba15bd9bdf13b22d0843b59e946a59..4ba37d1128a358b220cd7d7d4e03f14b535f9b90 100644 --- a/src/margo-timer.c +++ b/src/margo-timer.c @@ -139,8 +139,10 @@ void margo_timer_destroy( void margo_check_timers( margo_instance_id mid) { + int ret; margo_timer_t *cur; struct margo_timer_instance *timer_inst; + ABT_pool *handler_pool; double now = ABT_get_wtime(); timer_inst = margo_get_timer_instance(mid); @@ -157,8 +159,11 @@ void margo_check_timers( DL_DELETE(timer_inst->queue_head, cur); cur->prev = cur->next = NULL; - /* execute callback */ - cur->cb_fn(cur->cb_dat); + /* schedule callback on the handler pool */ + handler_pool = margo_get_handler_pool(mid); + ret = ABT_thread_create(*handler_pool, cur->cb_fn, cur->cb_dat, + ABT_THREAD_ATTR_NULL, NULL); + assert(ret == ABT_SUCCESS); } ABT_mutex_unlock(timer_inst->mutex);