sylvan_sys/
lace.rs

1use libc::{c_int, c_uint, c_void, size_t};
2use std::marker::{PhantomData, PhantomPinned};
3
4/// An opaque C struct used to represent a Lace worker.
5#[repr(C)]
6pub struct WorkerP {
7    _data: [u8; 0],
8    _marker: PhantomData<(*mut u8, PhantomPinned)>,
9}
10
11/// An opaque C struct used to represent a Lace task.
12#[repr(C)]
13pub struct Task {
14    _data: [u8; 0],
15    _marker: PhantomData<(*mut u8, PhantomPinned)>,
16}
17
18extern "C" {
19    pub fn Lace_set_verbosity(level: c_int) -> c_void;
20    pub fn Lace_set_stacksize(stacksize: size_t) -> c_void;
21    pub fn Lace_get_stacksize() -> size_t;
22    pub fn Lace_get_pu_count() -> c_uint;
23    pub fn Lace_start(n_workers: c_uint, dqsize: size_t) -> c_void;
24    pub fn Lace_suspend() -> c_void;
25    pub fn Lace_resume() -> c_void;
26    pub fn Lace_stop() -> c_void;
27    pub fn Lace_barrier() -> c_void;
28    pub fn Lace_workers() -> c_uint;
29    pub fn Lace_get_worker() -> *mut WorkerP;
30    pub fn Lace_get_head(worker: *mut WorkerP) -> *mut Task;
31    pub fn Lace_run_task(task: *mut Task) -> c_void;
32    pub fn Lace_run_newframe(task: *mut Task) -> c_void;
33    pub fn Lace_run_together(task: *mut Task) -> c_void;
34}