Struct ocl::Event [−][src]
#[repr(C)] #[must_use = "futures do nothing unless polled"]pub struct Event(_);
An event representing a command or user created event.
Methods
impl Event
[src]
impl Event
pub fn empty() -> Event
[src]
pub fn empty() -> Event
Creates a new, empty (null) event which must be filled by a command, associating the event with it.
pub fn user<C: ClContextPtr>(context: C) -> OclCoreResult<Event>
[src]
pub fn user<C: ClContextPtr>(context: C) -> OclCoreResult<Event>
Creates a new, empty event which must be filled by a newly initiated command, associating the event with it.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns true if this event is 'empty' and has not yet been associated with a command.
pub fn set_unpark_callback(&self) -> OclCoreResult<()>
[src]
pub fn set_unpark_callback(&self) -> OclCoreResult<()>
Sets a callback function to trigger upon completion of this event which will unpark the current task.
To be used within the context of a futures task.
Panics
This function will panic if a task is not currently being executed. That is, this method can be dangerous to call outside of an implementation of poll.
pub unsafe fn register_event_relay(
&self,
user_event: Event
) -> OclCoreResult<()>
[src]
pub unsafe fn register_event_relay(
&self,
user_event: Event
) -> OclCoreResult<()>
Registers a user event to have its status set to complete
(CommandExecutionStatus::Complete
) immediately upon completion of
this event.
Deadlocks
Due to the nature of OpenCL queue implementations, care must be taken when using this function. OpenCL queue deadlocks may occur.
OpenCL queues generally use one thread per queue for the purposes of
callbacks, etc. As a rule of thumb, ensure that any OpenCL commands
preceding the causation/source event (self
) are in a separate queue
from any commands with the dependent/target event (user_event
).
Safety
The caller must ensure that user_event
was created with
Event::user()
and that it's status is
CommandExecutionStatus::Submitted
(the default upon creation).
pub fn info(&self, info_kind: EventInfo) -> OclCoreResult<EventInfoResult>
[src]
pub fn info(&self, info_kind: EventInfo) -> OclCoreResult<EventInfoResult>
Returns info about the event.
pub fn profiling_info(
&self,
info_kind: ProfilingInfo
) -> OclCoreResult<ProfilingInfoResult>
[src]
pub fn profiling_info(
&self,
info_kind: ProfilingInfo
) -> OclCoreResult<ProfilingInfoResult>
Returns info about the event.
pub fn queue_core(&self) -> OclCoreResult<CommandQueueCore>
[src]
pub fn queue_core(&self) -> OclCoreResult<CommandQueueCore>
Returns this event's associated command queue.
pub fn as_core(&self) -> &EventCore
[src]
pub fn as_core(&self) -> &EventCore
Returns a reference to the core pointer wrapper, usable by functions in
the core
module.
pub fn into_raw(self) -> cl_event
[src]
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
.
pub unsafe fn from_raw(ptr: cl_event) -> Event
[src]
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
.
Methods from Deref<Target = EventCore>
pub fn set_complete(&self) -> Result<(), Error>
[src]
pub fn set_complete(&self) -> Result<(), Error>
Sets this user created event to CommandExecutionStatus::Complete
.
Will return an error if this event is not a 'user' event (created
with ::user()
).
pub fn is_complete(&self) -> Result<bool, Error>
[src]
pub fn is_complete(&self) -> Result<bool, Error>
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.
pub fn wait_for(&self) -> Result<(), Error>
[src]
pub fn wait_for(&self) -> Result<(), Error>
Causes the command queue to wait until this event is complete before returning.
pub fn is_null(&self) -> bool
[src]
pub fn is_null(&self) -> bool
Returns whether or not this event is associated with a command or is a user event.
pub fn is_valid(&self) -> bool
[src]
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.
pub unsafe fn set_callback(
&self,
callback_receiver: extern "C" fn(*mut c_void, i32, *mut c_void),
user_data_ptr: *mut c_void
) -> Result<(), Error>
[src]
pub unsafe fn set_callback(
&self,
callback_receiver: extern "C" fn(*mut c_void, i32, *mut c_void),
user_data_ptr: *mut c_void
) -> Result<(), Error>
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
.
pub fn context(&self) -> Result<Context, Error>
[src]
pub fn context(&self) -> Result<Context, Error>
Returns the Context
associated with this event.
pub unsafe fn as_ptr_ref(&self) -> &*mut c_void
[src]
pub unsafe fn as_ptr_ref(&self) -> &*mut c_void
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.
pub unsafe fn as_ptr_mut(&mut self) -> &mut *mut c_void
[src]
pub unsafe fn as_ptr_mut(&mut self) -> &mut *mut c_void
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.
Trait Implementations
impl Clone for Event
[src]
impl Clone for Event
fn clone(&self) -> Event
[src]
fn clone(&self) -> Event
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Event
[src]
impl Debug for Event
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Hash for Event
[src]
impl Hash for Event
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialEq for Event
[src]
impl PartialEq for Event
fn eq(&self, other: &Event) -> bool
[src]
fn eq(&self, other: &Event) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Event) -> bool
[src]
fn ne(&self, other: &Event) -> bool
This method tests for !=
.
impl Eq for Event
[src]
impl Eq for Event
impl From<EventCore> for Event
[src]
impl From<EventCore> for Event
impl From<Event> for EventCore
[src]
impl From<Event> for EventCore
impl Default for Event
[src]
impl Default for Event
impl Deref for Event
[src]
impl Deref for Event
type Target = EventCore
The resulting type after dereferencing.
fn deref(&self) -> &EventCore
[src]
fn deref(&self) -> &EventCore
Dereferences the value.
impl DerefMut for Event
[src]
impl DerefMut for Event
impl AsRef<EventCore> for Event
[src]
impl AsRef<EventCore> for Event
impl Display for Event
[src]
impl Display for Event
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'e> ClEventPtrRef<'e> for Event
[src]
impl<'e> ClEventPtrRef<'e> for Event
unsafe fn as_ptr_ref(&'e self) -> &'e cl_event
[src]
unsafe fn as_ptr_ref(&'e self) -> &'e cl_event
impl<'a> ClNullEventPtr for &'a mut Event
[src]
impl<'a> ClNullEventPtr for &'a mut Event
fn alloc_new(&mut self) -> *mut cl_event
[src]
fn alloc_new(&mut self) -> *mut cl_event
unsafe fn clone_from<E: AsRef<EventCore>>(&mut self, ev: E)
[src]
unsafe fn clone_from<E: AsRef<EventCore>>(&mut self, ev: E)
impl ClWaitListPtr for Event
[src]
impl ClWaitListPtr for Event
unsafe fn as_ptr_ptr(&self) -> *const cl_event
[src]
unsafe fn as_ptr_ptr(&self) -> *const cl_event
Returns a pointer to the first pointer in this list.
fn count(&self) -> u32
[src]
fn count(&self) -> u32
Returns the number of items in this wait list.
impl<'a> ClWaitListPtr for &'a Event
[src]
impl<'a> ClWaitListPtr for &'a Event
unsafe fn as_ptr_ptr(&self) -> *const cl_event
[src]
unsafe fn as_ptr_ptr(&self) -> *const cl_event
Returns a pointer to the first pointer in this list.
fn count(&self) -> u32
[src]
fn count(&self) -> u32
Returns the number of items in this wait list.
impl Future for Event
[src]
impl Future for Event
type Item = ()
The type of value that this future will resolved with if it is successful. Read more
type Error = OclError
The type of error that this future will resolve with if it fails in a normal fashion. Read more
fn poll(&mut self) -> Poll<Self::Item, Self::Error>
[src]
fn poll(&mut self) -> Poll<Self::Item, Self::Error>
Query this future to see if its value has become available, registering interest if it is not. Read more
fn wait(self) -> Result<Self::Item, Self::Error>
[src]
fn wait(self) -> Result<Self::Item, Self::Error>
Block the current thread until this future is resolved. Read more
fn map<F, U>(self, f: F) -> Map<Self, F> where
F: FnOnce(Self::Item) -> U,
[src]
fn map<F, U>(self, f: F) -> Map<Self, F> where
F: FnOnce(Self::Item) -> U,
Map this future's result to a different type, returning a new future of the resulting type. Read more
fn map_err<F, E>(self, f: F) -> MapErr<Self, F> where
F: FnOnce(Self::Error) -> E,
[src]
fn map_err<F, E>(self, f: F) -> MapErr<Self, F> where
F: FnOnce(Self::Error) -> E,
Map this future's error to a different error, returning a new future. Read more
fn from_err<E>(self) -> FromErr<Self, E> where
E: From<Self::Error>,
[src]
fn from_err<E>(self) -> FromErr<Self, E> where
E: From<Self::Error>,
Map this future's error to any error implementing From
for this future's Error
, returning a new future. Read more
fn then<F, B>(self, f: F) -> Then<Self, B, F> where
B: IntoFuture,
F: FnOnce(Result<Self::Item, Self::Error>) -> B,
[src]
fn then<F, B>(self, f: F) -> Then<Self, B, F> where
B: IntoFuture,
F: FnOnce(Result<Self::Item, Self::Error>) -> B,
Chain on a computation for when a future finished, passing the result of the future to the provided closure f
. Read more
fn and_then<F, B>(self, f: F) -> AndThen<Self, B, F> where
B: IntoFuture<Error = Self::Error>,
F: FnOnce(Self::Item) -> B,
[src]
fn and_then<F, B>(self, f: F) -> AndThen<Self, B, F> where
B: IntoFuture<Error = Self::Error>,
F: FnOnce(Self::Item) -> B,
Execute another future after this one has resolved successfully. Read more
fn or_else<F, B>(self, f: F) -> OrElse<Self, B, F> where
B: IntoFuture<Item = Self::Item>,
F: FnOnce(Self::Error) -> B,
[src]
fn or_else<F, B>(self, f: F) -> OrElse<Self, B, F> where
B: IntoFuture<Item = Self::Item>,
F: FnOnce(Self::Error) -> B,
Execute another future if this one resolves with an error. Read more
fn select<B>(self, other: B) -> Select<Self, <B as IntoFuture>::Future> where
B: IntoFuture<Item = Self::Item, Error = Self::Error>,
[src]
fn select<B>(self, other: B) -> Select<Self, <B as IntoFuture>::Future> where
B: IntoFuture<Item = Self::Item, Error = Self::Error>,
Waits for either one of two futures to complete. Read more
fn select2<B>(self, other: B) -> Select2<Self, <B as IntoFuture>::Future> where
B: IntoFuture,
[src]
fn select2<B>(self, other: B) -> Select2<Self, <B as IntoFuture>::Future> where
B: IntoFuture,
Waits for either one of two differently-typed futures to complete. Read more
fn join<B>(self, other: B) -> Join<Self, <B as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
[src]
fn join<B>(self, other: B) -> Join<Self, <B as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
Joins the result of two futures, waiting for them both to complete. Read more
fn join3<B, C>(
self,
b: B,
c: C
) -> Join3<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
[src]
fn join3<B, C>(
self,
b: B,
c: C
) -> Join3<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
Same as join
, but with more futures.
fn join4<B, C, D>(
self,
b: B,
c: C,
d: D
) -> Join4<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
[src]
fn join4<B, C, D>(
self,
b: B,
c: C,
d: D
) -> Join4<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
Same as join
, but with more futures.
fn join5<B, C, D, E>(
self,
b: B,
c: C,
d: D,
e: E
) -> Join5<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future, <E as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
E: IntoFuture<Error = Self::Error>,
[src]
fn join5<B, C, D, E>(
self,
b: B,
c: C,
d: D,
e: E
) -> Join5<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future, <E as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
E: IntoFuture<Error = Self::Error>,
Same as join
, but with more futures.
fn into_stream(self) -> IntoStream<Self>
[src]
fn into_stream(self) -> IntoStream<Self>
Convert this future into a single element stream. Read more
fn flatten(self) -> Flatten<Self> where
Self::Item: IntoFuture,
<Self::Item as IntoFuture>::Error: From<Self::Error>,
[src]
fn flatten(self) -> Flatten<Self> where
Self::Item: IntoFuture,
<Self::Item as IntoFuture>::Error: From<Self::Error>,
Flatten the execution of this future when the successful result of this future is itself another future. Read more
fn flatten_stream(self) -> FlattenStream<Self> where
Self::Item: Stream,
<Self::Item as Stream>::Error == Self::Error,
[src]
fn flatten_stream(self) -> FlattenStream<Self> where
Self::Item: Stream,
<Self::Item as Stream>::Error == Self::Error,
Flatten the execution of this future when the successful result of this future is a stream. Read more
fn fuse(self) -> Fuse<Self>
[src]
fn fuse(self) -> Fuse<Self>
Fuse a future such that poll
will never again be called once it has completed. Read more
fn inspect<F>(self, f: F) -> Inspect<Self, F> where
F: FnOnce(&Self::Item),
[src]
fn inspect<F>(self, f: F) -> Inspect<Self, F> where
F: FnOnce(&Self::Item),
Do something with the item of a future, passing it on. Read more
fn catch_unwind(self) -> CatchUnwind<Self> where
Self: UnwindSafe,
[src]
fn catch_unwind(self) -> CatchUnwind<Self> where
Self: UnwindSafe,
Catches unwinding panics while polling the future. Read more
Create a cloneable handle to this future where all handles will resolve to the same result. Read more
impl<'a> From<Event> for EventArray
[src]
impl<'a> From<Event> for EventArray
fn from(event: Event) -> EventArray
[src]
fn from(event: Event) -> EventArray
Performs the conversion.
impl<'a> From<Event> for EventList
[src]
impl<'a> From<Event> for EventList
impl<'a> From<Event> for ClWaitListPtrEnum<'a>
[src]
impl<'a> From<Event> for ClWaitListPtrEnum<'a>
fn from(e: Event) -> ClWaitListPtrEnum<'a>
[src]
fn from(e: Event) -> ClWaitListPtrEnum<'a>
Performs the conversion.
impl<'a> From<&'a Event> for ClWaitListPtrEnum<'a>
[src]
impl<'a> From<&'a Event> for ClWaitListPtrEnum<'a>
fn from(e: &'a Event) -> ClWaitListPtrEnum<'a>
[src]
fn from(e: &'a Event) -> ClWaitListPtrEnum<'a>
Performs the conversion.
impl<'a> From<&'a mut Event> for ClWaitListPtrEnum<'a>
[src]
impl<'a> From<&'a mut Event> for ClWaitListPtrEnum<'a>
fn from(e: &'a mut Event) -> ClWaitListPtrEnum<'a>
[src]
fn from(e: &'a mut Event) -> ClWaitListPtrEnum<'a>
Performs the conversion.
impl<'a> From<&'a mut Event> for ClNullEventPtrEnum<'a>
[src]
impl<'a> From<&'a mut Event> for ClNullEventPtrEnum<'a>
fn from(e: &'a mut Event) -> ClNullEventPtrEnum<'a>
[src]
fn from(e: &'a mut Event) -> ClNullEventPtrEnum<'a>
Performs the conversion.