diff options
author | Junyan He <junyan.he@intel.com> | 2016-09-21 17:47:20 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2016-09-23 12:52:46 +0800 |
commit | adb62811ea72bad4018b8e0af2cedca513a9eea4 (patch) | |
tree | ba1c77a0ebc286dbcc984964a8585e8cb0be3de0 /src/cl_api_command_queue.c | |
parent | 7fd45f155d1603cdcb20498598308064e5054096 (diff) | |
download | beignet-adb62811ea72bad4018b8e0af2cedca513a9eea4.tar.gz |
Implement event related functions.
We want to implement the new event handle manner.
We also move the API to different files to avoid
a to big api.c file.
V2:
Fix a bug for readwrite_buffer_rect.
Signed-off-by: Junyan He <junyan.he@intel.com>
Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'src/cl_api_command_queue.c')
-rw-r--r-- | src/cl_api_command_queue.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/cl_api_command_queue.c b/src/cl_api_command_queue.c new file mode 100644 index 00000000..9f06deb7 --- /dev/null +++ b/src/cl_api_command_queue.c @@ -0,0 +1,55 @@ +/* + * Copyright © 2012 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ +#include "cl_command_queue.h" +#include "CL/cl.h" +#include <stdio.h> + +cl_int +clFlush(cl_command_queue command_queue) +{ + if (!CL_OBJECT_IS_COMMAND_QUEUE(command_queue)) { + return CL_INVALID_COMMAND_QUEUE; + } + + return cl_command_queue_wait_flush(command_queue); +} + +cl_int +clFinish(cl_command_queue command_queue) +{ + if (!CL_OBJECT_IS_COMMAND_QUEUE(command_queue)) { + return CL_INVALID_COMMAND_QUEUE; + } + + return cl_command_queue_wait_finish(command_queue); +} + + +cl_int +clReleaseCommandQueue(cl_command_queue command_queue) +{ + if (!CL_OBJECT_IS_COMMAND_QUEUE(command_queue)) { + return CL_INVALID_COMMAND_QUEUE; + } + + cl_command_queue_wait_flush(command_queue); + + cl_command_queue_delete(command_queue); + return CL_SUCCESS; +} + |