Trait Waitlist

Source
pub unsafe trait Waitlist: Sized {
    // Required methods
    unsafe fn fill_waitlist(&self, wl: &mut Vec<*mut _cl_event>);
    unsafe fn new_waitlist(&self) -> Vec<*mut _cl_event>;

    // Provided method
    unsafe fn wait(self) -> Result<(), Error> { ... }
}
Expand description

The low level trait for synchronously waiting for events.

§Safety

Due to multiple dangerous memory safety concerns with using events this trait and it’s functions are all unsafe. Mismanagement of the reference count, lifetime, context, or resuse of an event is undefined behavior.

Required Methods§

Source

unsafe fn fill_waitlist(&self, wl: &mut Vec<*mut _cl_event>)

Copies the waitlist’s (self) events into the passed mutable vector.

§Safety

Due to the movement of cl_event from one container to another, this function is unsafe failure to correctly track reference counts of cl_event objects can lead to memory leaks and/or segfaults.

Note: When the vec that the events are given to Drops these events will not be released.

Source

unsafe fn new_waitlist(&self) -> Vec<*mut _cl_event>

Consumes the waitlist into a vector of cl_events.

§Safety

Due to the movement of cl_event from one container to another, this function is unsafe failure to correctly track reference counts of cl_event objects can lead to memory leaks and/or segfaults.

Note: When the vec that the events are given to Drops these events will not be released.

Provided Methods§

Source

unsafe fn wait(self) -> Result<(), Error>

Synchronously waits (blocks the thread) until all events in the waitlist are complete.

§Safety

Due to call to OpenCL’s FFI with raw pointer (or Vec of raw pointers) this call will cause undefined behavior if any of the events is not in correct state, if the context of the events has been freed, if any of the events is a null pointer, if the queue the event was created with is freed, and a plethora of other conditions.

Note: When the vec that the events are given to Drops these events will not be released.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Waitlist for &[*mut _cl_event]

Source§

unsafe fn fill_waitlist(&self, wait_list: &mut Vec<*mut _cl_event>)

Source§

unsafe fn new_waitlist(&self) -> Vec<*mut _cl_event>

Source§

impl Waitlist for &[ObjectWrapper<*mut _cl_event>]

Source§

unsafe fn fill_waitlist(&self, wait_list: &mut Vec<*mut _cl_event>)

Source§

unsafe fn new_waitlist(&self) -> Vec<*mut _cl_event>

Source§

impl<W> Waitlist for Option<W>
where W: Waitlist,

Source§

unsafe fn fill_waitlist(&self, wait_list: &mut Vec<*mut _cl_event>)

Source§

unsafe fn new_waitlist(&self) -> Vec<*mut _cl_event>

Implementors§