dope-sys 0.31.0

Typed operating-system call contracts
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::{cell::Cell, ptr::NonNull};

use dope_sys::thread::raw::Task;

pub struct Completed(pub Cell<bool>);

// SAFETY: the test retains this context at a stable address and grants only the
// worker access to the cell until native joining returns ownership to the test.
unsafe impl Task for Completed {
    unsafe fn run(context: NonNull<Self>) {
        // SAFETY: Entry admits this initialized context for this sole execution.
        unsafe { context.as_ref() }.0.set(true);
    }
}