Struct ocl_core::types::abs::Event

source ·
#[repr(C)]
pub struct Event(/* private fields */);
Expand description

cl_event

Implementations§

source§

impl Event

source

pub fn null() -> Event

For passage directly to an ‘event creation’ function (such as enqueue…).

source

pub fn user<C: ClContextPtr>(context: C) -> OclCoreResult<Event>

Creates and returns a new ‘user’ event.

User events are events which are meant to have their completion status set from the host side (that means you).

source

pub unsafe fn from_raw_create_ptr(ptr: cl_event) -> Event

Only call this when passing the original newly created pointer directly from clCreate.... Do not use this to clone or copy.

source

pub unsafe fn from_raw_copied_ptr(ptr: cl_event) -> OclCoreResult<Event>

Only use when cloning or copying from a pre-existing and valid cl_event.

source

pub fn set_complete(&self) -> OclCoreResult<()>

Sets this user created event to CommandExecutionStatus::Complete.

Will return an error if this event is not a ‘user’ event (created with ::user()).

source

pub fn is_complete(&self) -> OclCoreResult<bool>

Queries the command status associated with this event and returns true if it is complete, false if incomplete or upon error.

This is the fastest possible way to determine event status.

source

pub fn wait_for(&self) -> OclCoreResult<()>

Causes the command queue to wait until this event is complete before returning.

source

pub fn is_null(&self) -> bool

Returns whether or not this event is associated with a command or is a user event.

source

pub fn is_valid(&self) -> bool

[FIXME]: ADD VALIDITY CHECK BY CALLING ‘_INFO’ OR SOMETHING: NULL CHECK IS NOT ENOUGH

This still leads to crazy segfaults when non-event pointers (random whatever addresses) are passed. Need better check.

source

pub unsafe fn set_callback( &self, callback_receiver: EventCallbackFn, user_data_ptr: *mut c_void ) -> OclCoreResult<()>

Sets a callback function, callback_receiver, to trigger upon completion of this event with an optional pointer to user data.

The callback function must have a signature matching: extern "C" fn (ffi::cl_event, i32, *mut libc::c_void)

Safety

user_data must be guaranteed to still exist if and when callback_receiver is ever called.

TODO: Create a safer type wrapper for callback_receiver (using an Arc?, etc.) within ocl.

source

pub fn context(&self) -> OclCoreResult<Context>

Returns the Context associated with this event.

source

pub unsafe fn as_ptr_ref(&self) -> &cl_event

Returns an immutable reference to a pointer, do not deref and store it unless you will manage its associated reference count carefully.

Warning

DO NOT store this pointer.

DO NOT send this pointer across threads unless you are incrementing the reference count before sending and decrementing after sending.

Use ::into_raw for these purposes. Thank you.

source

pub unsafe fn as_ptr_mut(&mut self) -> &mut cl_event

Returns a mutable reference to a pointer, do not deref then modify or store it unless you will manage its associated reference count carefully.

Warning

DO NOT store this pointer.

DO NOT send this pointer across threads unless you are incrementing the reference count before sending and decrementing after sending.

Use ::into_raw for these purposes. Thank you.

source

pub fn into_raw(self) -> cl_event

Consumes the Event, returning the wrapped cl_event pointer.

To avoid a memory leak the pointer must be converted back to an Event using Event::from_raw.

source

pub unsafe fn from_raw(ptr: cl_event) -> Event

Constructs an Event from a raw cl_event pointer.

The raw pointer must have been previously returned by a call to a Event::into_raw.

Trait Implementations§

source§

impl AsRef<Event> for Event

source§

fn as_ref(&self) -> &Event

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<'e> ClEventPtrRef<'e> for Event

source§

unsafe fn as_ptr_ref(&'e self) -> &'e cl_event

source§

impl<'a> ClNullEventPtr for &'a mut Event

source§

fn alloc_new(&mut self) -> *mut cl_event

source§

unsafe fn clone_from<E: AsRef<Event>>(&mut self, ev: E)

source§

impl<'a> ClWaitListPtr for &'a Event

source§

unsafe fn as_ptr_ptr(&self) -> *const cl_event

Returns a pointer to the first pointer in this list.
source§

fn count(&self) -> u32

Returns the number of items in this wait list.
source§

impl ClWaitListPtr for Event

source§

unsafe fn as_ptr_ptr(&self) -> *const cl_event

Returns a pointer to the first pointer in this list.
source§

fn count(&self) -> u32

Returns the number of items in this wait list.
source§

impl Clone for Event

source§

fn clone(&self) -> Event

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Event

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Event

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Hash for Event

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Event

source§

fn eq(&self, other: &Event) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Event

source§

impl Send for Event

source§

impl StructuralEq for Event

source§

impl StructuralPartialEq for Event

source§

impl Sync for Event

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.