diff options
author | Junyan He <junyan.he@intel.com> | 2016-04-26 17:04:42 +0800 |
---|---|---|
committer | Junyan He <junyan.he@intel.com> | 2016-04-26 17:04:42 +0800 |
commit | 2ca26fd351bcdb3fa3f03802c3ae5919e7788b5d (patch) | |
tree | 3b8b23c0ba2c27b3f2f25a10916557b96114adec | |
parent | 85a0b5eb1673168ee1fab2babc902c114b72e802 (diff) |
add finish
-rw-r--r-- | libclapi/cl_enqueue.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/libclapi/cl_enqueue.c b/libclapi/cl_enqueue.c index 932d6866..d56b6afa 100644 --- a/libclapi/cl_enqueue.c +++ b/libclapi/cl_enqueue.c @@ -440,12 +440,12 @@ LOCAL cl_int cl_enqueue_wait_for_events(cl_command_queue queue, const cl_event* CL_MUTEX_LOCK(&worker->mutex); - if (worker->quit) { // already destroy the queue? - CL_MUTEX_UNLOCK(&worker->mutex); - return CL_INVALID_COMMAND_QUEUE; - } - while (1) { + if (worker->quit) { // already destroy the queue? + CL_MUTEX_UNLOCK(&worker->mutex); + return CL_INVALID_COMMAND_QUEUE; + } + need_to_wait = CL_FALSE; for (i = 0; i < num; i++) { assert(events[i]); @@ -467,18 +467,10 @@ LOCAL cl_int cl_enqueue_wait_for_events(cl_command_queue queue, const cl_event* if (need_to_wait) { CL_COND_WAIT(&worker->cond, &worker->mutex); } else { // All events are ready, OK now. - CL_MUTEX_UNLOCK(&worker->mutex); - return CL_SUCCESS; - } - - if (worker->quit) { // already destroy the queue? - CL_MUTEX_UNLOCK(&worker->mutex); - return CL_INVALID_COMMAND_QUEUE; + break; } } - // FAKE: Should never get here. - assert(0); CL_MUTEX_UNLOCK(&worker->mutex); return CL_SUCCESS; } |