Triton Repository branch, master, updated. f6ba13d5b9c07beee9a33ae5b39c13cc42118383
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Triton Repository". The branch, master has been updated via f6ba13d5b9c07beee9a33ae5b39c13cc42118383 (commit) from 101a6d1f851d461ca54c17ab2fbe310425820ca2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f6ba13d5b9c07beee9a33ae5b39c13cc42118383 Author: Phil Carns <[email protected]> Date: Thu Feb 24 16:05:20 2011 -0500 fix a race condition in sched resource ----------------------------------------------------------------------- Summary of changes: code/src/common/resources/scheduling/sched.c | 31 +++++++++++++------------ 1 files changed, 16 insertions(+), 15 deletions(-) Diff of changes: diff --git a/code/src/common/resources/scheduling/sched.c b/code/src/common/resources/scheduling/sched.c index 478439c..5ebaeb2 100644 --- a/code/src/common/resources/scheduling/sched.c +++ b/code/src/common/resources/scheduling/sched.c @@ -143,6 +143,7 @@ static triton_ret_t triton_sched_poll(ae_context_t context) { struct ae_op *op; struct triton_sched_id_s *result; + int internal; triton_mutex_lock(&sched_done_mutex); while(ae_ops_count(&sched_done_queue) > 0) @@ -156,23 +157,23 @@ static triton_ret_t triton_sched_poll(ae_context_t context) result = ae_op_entry(op, struct triton_sched_id_s, op); triton_mutex_lock(result->mutex); - /* save callback and user pointer so that we can release the op - * safely before triggering the callback - */ - callback = op->callback; - user_ptr = op->user_ptr; + internal = result->internal; ret = result->state == TRITON_SCHED_STATE_CANCELED ? TRITON_ERR_CANCELED : TRITON_SUCCESS; - - /* must call callback before operation is freed (handed back to opcache) */ - callback(user_ptr, ret); - if(result->internal) - { - ae_opcache_put(sched_opcache, op); - } - else - { + if(internal) + { + ae_opcache_complete_op(sched_opcache, op, triton_ret_t, ret); + } + else + { + callback = op->callback; + user_ptr = op->user_ptr; + /* NOTE: the callback in this case might free the control + * structure that holds the op, so we can't touch it any more + * after calling the callback. + */ ae_op_clear(op); - } + callback(user_ptr, ret); + } triton_mutex_lock(&sched_done_mutex); } hooks/post-receive -- Triton Repository
participants (1)
-
noreply@mcs.anl.gov