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]
fn empty() -> Event
Creates a new, empty (null) event which must be filled by a command, associating the event with it.
fn user<C: ClContextPtr>(context: C) -> OclResult<Event>
Creates a new, empty event which must be filled by a newly initiated command, associating the event with it.
fn is_empty(&self) -> bool
Returns true if this event is 'empty' and has not yet been associated with a command.
fn set_unpark_callback(&self) -> OclResult<()>
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.
fn info(&self, info_kind: EventInfo) -> EventInfoResult
Returns info about the event.
fn profiling_info(&self, info_kind: ProfilingInfo) -> ProfilingInfoResult
Returns info about the event.
fn queue_core(&self) -> OclResult<CommandQueueCore>
Returns this event's associated command queue.
fn core(&self) -> &EventCore
Returns a reference to the core pointer wrapper, usable by functions in
the core
module.
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
.
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>
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()
).
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.
fn wait_for(&self) -> Result<(), Error>
Causes the command queue to wait until this event is complete before returning.
fn is_null(&self) -> bool
Returns whether or not this event is associated with a command or is a user event.
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.
unsafe fn set_callback(
&self,
callback_receiver: extern fn(*mut c_void, i32, *mut c_void),
user_data_ptr: *mut c_void
) -> Result<(), Error>
&self,
callback_receiver: extern 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
.
fn context(&self) -> Result<Context, Error>
Returns the Context
associated with this event.
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.
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.
fn into_raw(self) -> *mut c_void
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
.
Trait Implementations
impl Clone for Event
[src]
fn clone(&self) -> Event
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Event
[src]
impl From<EventCore> for Event
[src]
impl Default for Event
[src]
impl Deref for Event
[src]
type Target = EventCore
The resulting type after dereferencing
fn deref(&self) -> &EventCore
The method called to dereference a value
impl DerefMut for Event
[src]
impl AsRef<EventCore> for Event
[src]
impl Display for Event
[src]
impl<'e> ClEventPtrRef<'e> for Event
[src]
unsafe fn as_ptr_ref(&'e self) -> &'e cl_event
impl<'a> ClNullEventPtr for &'a mut Event
[src]
fn alloc_new(&mut self) -> *mut cl_event
unsafe fn clone_from<E: AsRef<EventCore>>(&mut self, ev: E)
impl ClWaitListPtr for 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
Returns the number of items in this wait list.
impl<'a> ClWaitListPtr for &'a 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
Returns the number of items in this wait list.
impl Future for Event
[src]
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>
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>
Block the current thread until this future is resolved. Read more
fn boxed(
self
) -> Box<Future<Error = Self::Error, Item = Self::Item> + 'static + Send> where
Self: Send + 'static,
self
) -> Box<Future<Error = Self::Error, Item = Self::Item> + 'static + Send> where
Self: Send + 'static,
Convenience function for turning this future into a trait object which is also Send
. Read more
fn map<F, U>(self, f: F) -> Map<Self, F> where
F: FnOnce(Self::Item) -> U,
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,
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>,
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,
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,
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,
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::Future> where
B: IntoFuture<Item = Self::Item, Error = Self::Error>,
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::Future> where
B: IntoFuture,
B: IntoFuture,
Waits for either one of two differently-typed futures to complete. Read more
fn join<B>(self, other: B) -> Join<Self, B::Future> where
B: IntoFuture<Error = Self::Error>,
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::Future, C::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
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::Future, C::Future, D::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
self,
b: B,
c: C,
d: D
) -> Join4<Self, B::Future, C::Future, D::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::Future, C::Future, D::Future, E::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
E: IntoFuture<Error = Self::Error>,
self,
b: B,
c: C,
d: D,
e: E
) -> Join5<Self, B::Future, C::Future, D::Future, E::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>
Convert this future into a single element stream. Read more
fn flatten(self) -> Flatten<Self> where
Self::Item: IntoFuture,
Self::Item::Error: From<Self::Error>,
Self::Item: IntoFuture,
Self::Item::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::Error == Self::Error,
Self::Item: Stream,
Self::Item::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>
Fuse a future such that poll
will never again be called once it has completed. Read more
fn catch_unwind(self) -> CatchUnwind<Self> where
Self: UnwindSafe,
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