summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunyan He <junyan.he@intel.com>2016-04-26 17:41:44 +0800
committerJunyan He <junyan.he@intel.com>2016-04-26 17:41:44 +0800
commit3bb67a614cbd2a69248bb91cff2e53cf19fb46fc (patch)
tree7e8d33ebbf27484b005477b15bd278a145175be4
parent2ca26fd351bcdb3fa3f03802c3ae5919e7788b5d (diff)
add finish
-rw-r--r--libclapi/cl_command_queue.c4
-rw-r--r--libclapi/cl_enqueue.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/libclapi/cl_command_queue.c b/libclapi/cl_command_queue.c
index e3e76860..4e9e4f4b 100644
--- a/libclapi/cl_command_queue.c
+++ b/libclapi/cl_command_queue.c
@@ -99,9 +99,13 @@ LOCAL void cl_release_command_queue(cl_command_queue queue)
{
assert(queue);
+ cl_flush(queue);
+
if (cl_ref_dec(&queue->ref_n) > 1)
return;
+ cl_finish(queue);
+
/* Remove it from the list */
assert(queue->ctx);
assert(queue->device);
diff --git a/libclapi/cl_enqueue.c b/libclapi/cl_enqueue.c
index d56b6afa..ef3ada61 100644
--- a/libclapi/cl_enqueue.c
+++ b/libclapi/cl_enqueue.c
@@ -466,7 +466,8 @@ 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.
+ } else {
+ // All events are ready, OK now.
break;
}
}