Gocl - Documentation and Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
struct GoclEvent; void (*GoclEventCallback) (GoclEvent *self
,GError *error
,gpointer user_data
); struct GoclEventClass; void (*GoclEventResolverFunc) (GoclEvent *self
,GError *error
); cl_event gocl_event_get_event (GoclEvent *self
); GoclQueue * gocl_event_get_queue (GoclEvent *self
); void gocl_event_idle_unref (GoclEvent *self
); cl_event * gocl_event_list_to_array (GList *event_list
,gsize *len
); GoclEventResolverFunc gocl_event_steal_resolver_func (GoclEvent *self
); void gocl_event_then (GoclEvent *self
,GoclEventCallback callback
,gpointer user_data
);
"event" gpointer : Read / Write / Construct Only "queue" GoclQueue* : Read / Write / Construct Only
A GoclEvent is created as the result of requesting an asynchronous
operation on a GoclQueue (the command queue of a device). Examples
of these operations are the execution of a kernel with
gocl_kernel_run_in_device()
and reading from / writing to GoclBuffer
objects in a non-blocking fashion (not yet implemented).
A GoclEvent is used by applications to get a notification when the
corresponding operation completes, by calling gocl_event_then()
.
GoclEvent's are also the building blocks of synchronization
in OpenCL. The application developer will notice that most operations
include a event_wait_list
argument, which asks OpenCL to wait for
the completion of all GoclEvent's in the list, before starting the
operation in question. This pattern greatly simplifies the application
logic and allows for complex algorithms to be splitted in smaller,
synchronized routines.
A GoclEvent is always associated with a GoclQueue, which represents
the command queue where the operation represented by the event was
originally queued. The GoclQueue can be retrieved using
gocl_event_get_queue()
.
void (*GoclEventCallback) (GoclEvent *self
,GError *error
,gpointer user_data
);
Prototype of the callback
argument of gocl_event_then()
.
|
The GoclEvent |
|
A GError if an error ocurred, NULL otherwise |
|
The arbitrary pointer passed in gocl_event_then() ,
or NULL
|
struct GoclEventClass { GObjectClass parent_class; };
The class for GoclEvent objects.
GObjectClass |
The parent class |
void (*GoclEventResolverFunc) (GoclEvent *self
,GError *error
);
Prototype of the function that notifies the completion of an event.
This function is not normally called directly by applications. The object
that creates the event is responsible for stealing the resolver function
with gocl_event_steal_resolver_func()
, and then resolve the event with
success or error by calling this method, when the related operation
completes.
cl_event gocl_event_get_event (GoclEvent *self
);
Retrieves the OpenCL internal cl_event object. This is a rather low-level method that should not normally be called by applications.
|
The GoclEvent |
Returns : |
The internal cl_event object. [transfer none][type guint64] |
GoclQueue * gocl_event_get_queue (GoclEvent *self
);
Retrieves the GoclQueue object where the operation that created this event was queued.
void gocl_event_idle_unref (GoclEvent *self
);
Schedules an object de-reference in an idle call. This is a rather low-level method and should not normally be called by applications.
|
The GoclEvent |
cl_event * gocl_event_list_to_array (GList *event_list
,gsize *len
);
A convenient method to retrieve a GList of GoclEvent's as an array of cl_event's corresponding to the internal objects of each GoclEvent in the GList. This is a rather low-level method and should not normally be called by applications.
GoclEventResolverFunc gocl_event_steal_resolver_func (GoclEvent *self
);
Steals the internal resolver function from this event and sets it to NULL
,
so that only the first caller is able to resolve this event. This is a rather
low-level method that should not normally be called by applications.
This method is intended to secure the GoclEvent, to guarantee that the creator of the event has exclusive control over the triggering of the event.
|
The GoclEvent |
Returns : |
The internal resolver function. [transfer none] |
void gocl_event_then (GoclEvent *self
,GoclEventCallback callback
,gpointer user_data
);
Requests for a notification when the operation represented by this event
has finished. When this event triggers, callback
will be called
passing user_data
as argument, if provided.
If the event already triggered when this method is called, the notification is immediately scheduled as an idle call.
|
The GoclEvent |
|
A callback with a GoclEventCallback signature. [scope async] |
|
Arbitrary data to pass in callback , or NULL . [allow-none]
|