clSetEventCallback - Registers a user callback function for a specific command execution status.
cl_int clSetEventCallback(cl_event event, cl_int command_exec_callback_type, void (CL_CALLBACK *pfn_event_notify) (cl_event event, cl_int event_command_exec_status, void *user_data), void *user_data);
The callback function registered for a command_exec_callback_type value of CL_COMPLETE will be called when the command has completed successfully or is abnormally terminated.
The registered callback function will be called when the execution status of command associated with event changes to an execution status equal to or past the status specified by command_exec_status.
Each call to clSetEventCallback registers the specified user callback function on a callback stack associated with event. The order in which the registered user callback functions are called is undefined.
All callbacks registered for an event object must be called. All enqueued callbacks shall be called before the event object is destroyed. Callbacks must return promptly. The behavior of calling expensive system routines, OpenCL API calls to create contexts or command-queues, or blocking OpenCL operations from the following list below, in a callback is undefined.
If an application needs to wait for completion of a routine from the above list in a callback, please use the non-blocking form of the function, and assign a completion callback to it to do the remainder of your work. Note that when a callback (or other code) enqueues commands to a command-queue, the commands are not required to begin execution until the queue is flushed. In standard usage, blocking enqueue calls serve this role by implicitly flushing the queue. Since blocking calls are not permitted in callbacks, those callbacks that enqueue commands on a command queue should either call clFlush(3clc) on the queue before returning or arrange for clFlush(3clc) to be called later on another thread.
Returns CL_SUCCESS if the function is executed successfully. Otherwise, it returns one of the following errors:
The Khronos Group
Copyright © 2007-2011 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.
- OpenCL Specification
|01/14/2021||The Khronos Group|