[][src]Struct ispc::task::Context

pub struct Context {
    pub id: usize,
    // some fields omitted
}

A list of all task groups spawned by a function in some launch context which will be sync'd at an explicit sync call or function exit.

Note: A Context is done if and only if ISPCSync has been called with its handle and all of its tasks are finished. Until ISPCSync is called on the Context's handle more tasks could be launched.

Additionally, because we're not really able to associate a call to ISPCAlloc with a specific Group care must be taken that the Context is not dropped until ISPCSync has been called on its handle and all Groups within have completed execution.

Fields

id: usize

A unique identifier for this context

Methods

impl Context[src]

pub fn new(id: usize) -> Context[src]

Create a new list of tasks for some function with id id

pub fn launch(
    &self,
    total: (i32, i32, i32),
    data: *mut c_void,
    fcn: extern "C" fn(*mut c_void, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32)
)
[src]

Add a task group for execution that was launched in this context

pub fn current_tasks_done(&self) -> bool[src]

Check if all tasks currently in the task list are completed

Note: A Context is done if and only if ISPCSync has been called with its handle and all of its tasks are finished. Until ISPCSync is called on the Context's handle more tasks could be launched. TODO: With this design we're essentially requiring the thread waiting on the context to busy wait since we provide no condition variable to block on.

pub unsafe fn alloc(&self, size: usize, align: usize) -> *mut c_void[src]

Allocate some memory for this Context's task groups, returns a pointer to the allocated memory.

Important traits for ContextIter<'a>
pub fn iter(&self) -> ContextIter[src]

An iterator over the current groups in the context which have remaining tasks to run on a thread. If more task groups are added before this iterator has returned None those will appear as well.

Trait Implementations

impl Debug for Context[src]

impl Drop for Context[src]

fn drop(&mut self)[src]

Release memory for all the tasks in this context

Note: that because we're not really able to associate a call to ISPCAlloc with a specific Group care must be taken that the Context is not dropped until ISPCSync has been called on its handle and all Groups within have completed execution.

Auto Trait Implementations

impl Unpin for Context

impl Sync for Context

impl Send for Context

impl UnwindSafe for Context

impl RefUnwindSafe for Context

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]