pub struct SharedTask { /* private fields */ }
Available on crate features
shared_mem
or pocl_extensions
only.Implementations§
Sourcepub async fn wait(&self)
pub async fn wait(&self)
Await the completetion of the shared task.
This is an asynchronous operation, meaning that no work is actually performed until
the returned future is actualy await
ed.
While awaiting a task execution, the user application will not make forward progress until
the underylying device has executed the task and performed any necessary data transfers.
Upon return from the await call, any output data is gauranteed to be written to its approriate buffer.
Task execution order can be enforced be sequentially awaiting tasks, or may be executed simultaneous using data structures such as Join_all https://docs.rs/futures/latest/futures/future/fn.join_all.html
§Examples
let mcl = mcl_rs::MclEnvBuilder::new().num_workers(10).initialize();
mcl.load_prog("my_path", mcl_rs::PrgType::Src);
let pid = 0; //user is required to set this approriately
let task_ids = [0,1,2,3]; //user is required to set this approriately
let t1 = mcl.attach_shared_task(pid,task_ids[0]);
let t2 = mcl.attach_shared_task(pid,task_ids[1]);
let t3 = mcl.attach_shared_task(pid,task_ids[2]);
let t4 = mcl.attach_shared_task(pid,task_ids[3]);
let tasks = async move {
t1.await;
t2.await;
futures::future::join_all([t3,t4]).await;
}
futures::executor::block_on(tasks);
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more