#include <itkOpenCLUserEvent.h>
The OpenCLUserEvent class represents OpenCL user events.
User events allow applications to enqueue commands that wait on a user event to finish before the command is executed by the device. Commands that depend upon the user event will not be executed until the application triggers the user event with SetComplete(). User events are constructed with OpenCLContext::CreateUserEvent().
{CL_COMPLETE} or an error. If the user event was used in the OpenCLEventList argument passed to a clEnqueue*** API or another application host thread is waiting for it in OpenCLEvent::WaitForFinished(), those commands and host threads will continue to wait for the event status to reach
{CL_COMPLETE} or error, even after the user has released the object. Since in this scenario the developer has released his last reference count to the user event, it would be in principle no longer valid for him to change the status of the event to unblock all the other machinery. As a result the waiting tasks will wait forever, and associated events, cl_mem objects, command queues and contexts are likely to leak. In-order command queues caught up in this deadlock may cease to do any work.Definition at line 66 of file itkOpenCLUserEvent.h.
Public Types | |
using | Self = OpenCLUserEvent |
Public Types inherited from itk::OpenCLEvent | |
using | Self = OpenCLEvent |
Public Member Functions | |
OpenCLUserEvent () | |
OpenCLUserEvent (cl_event id) | |
OpenCLUserEvent (const OpenCLEvent &other) | |
OpenCLUserEvent & | operator= (const OpenCLEvent &other) |
void | SetComplete () |
void | SetStatus (const cl_int status) |
Public Member Functions inherited from itk::OpenCLEvent | |
cl_command_type | GetCommandType () const |
cl_event | GetEventId () const |
cl_ulong | GetFinishTime () const |
cl_ulong | GetQueueTime () const |
cl_ulong | GetRunTime () const |
cl_int | GetStatus () const |
cl_ulong | GetSubmitTime () const |
bool | IsComplete () const |
bool | IsError () const |
bool | IsNull () const |
bool | IsQueued () const |
bool | IsRunning () const |
bool | IsSubmitted () const |
OpenCLEvent () | |
OpenCLEvent (const cl_event id) | |
OpenCLEvent (const OpenCLEvent &other) | |
OpenCLEvent & | operator= (const OpenCLEvent &other) |
cl_int | SetCallback (cl_int type, void(CL_CALLBACK *pfn_notify)(cl_event, cl_int, void *), void *user_data=nullptr) |
cl_int | WaitForFinished () |
~OpenCLEvent () | |
Private Member Functions | |
OpenCLUserEvent (cl_event id, bool) | |
void | ReleaseIfNotUserEvent () |
Friends | |
class | OpenCLContext |
Standard class typedefs.
Definition at line 70 of file itkOpenCLUserEvent.h.
|
inline |
Constructs a null user event.
Definition at line 73 of file itkOpenCLUserEvent.h.
itk::OpenCLUserEvent::OpenCLUserEvent | ( | cl_event | id | ) |
Constructs an OpenCL event object from the native identifier id. This class takes over ownership of id and will release it in the destructor. If id is not a user event, then the newly constructed event will be set to null, and id will be released.
itk::OpenCLUserEvent::OpenCLUserEvent | ( | const OpenCLEvent & | other | ) |
Constructs a copy of other. The {clRetainEvent()} function will be called to update the reference count on GetEventId(). If other is not a user event, then the newly constructed event will be set to null.
|
inlineprivate |
Definition at line 116 of file itkOpenCLUserEvent.h.
OpenCLUserEvent & itk::OpenCLUserEvent::operator= | ( | const OpenCLEvent & | other | ) |
Assigns other to this OpenCL event object. The current GetEventId() will be released with {clReleaseEvent()}, and the new GetEventId() will be retained with
{clRetainEvent()}. If other is not a user event, then this event will be set to null.
|
private |
Checks the event type agains {CL_COMMAND_USER} and release it if not.
void itk::OpenCLUserEvent::SetComplete | ( | ) |
Sets this user event to the complete state. Any queued commands that depend upon this event can now proceed.
void itk::OpenCLUserEvent::SetStatus | ( | const cl_int | status | ) |
Sets the status of this user event. The status should be either {CL_COMPLETE} or a negative OpenCL error code.
|
friend |
friends from OpenCL core
Definition at line 121 of file itkOpenCLUserEvent.h.
Generated on 2024-07-17 for elastix by 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) |