Skip to content

Commit

Permalink
Stub
Browse files Browse the repository at this point in the history
  • Loading branch information
vertexclique committed Oct 12, 2019
1 parent 719b3c5 commit a48bec7
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lightproc/src/lib.rs
@@ -0,0 +1,5 @@
mod lightproc;
mod proc_handle;
mod proc_data;
mod proc_vtable;
mod state;
4 changes: 4 additions & 0 deletions lightproc/src/lightproc.rs
@@ -0,0 +1,4 @@

pub struct LightProc {

}
12 changes: 12 additions & 0 deletions lightproc/src/proc_data.rs
@@ -0,0 +1,12 @@
use std::task::Waker;
use std::cell::UnsafeCell;
use proc_vtable::ProcVTable;
use std::sync::atomic::{AtomicUsize, Ordering};

pub(crate) struct ProcData {
pub(crate) state: AtomicUsize,

pub(crate) awaiter: UnsafeCell<Option<Waker>>,

pub(crate) vtable: &'static ProcVTable,
}
24 changes: 24 additions & 0 deletions lightproc/src/proc_handle.rs
@@ -0,0 +1,24 @@
use std::ptr::NonNull;
use std::marker::PhantomData as marker;

pub struct ProcHandle<R, T> {
raw_proc: NonNull<()>,
_private: marker<(R, T)>
}

unsafe impl<R, T> Send for ProcHandle<R, T> {}
unsafe impl<R, T> Sync for ProcHandle<R, T> {}

impl<R, T> Unpin for ProcHandle<R, T> {}

impl<R, T> ProcHandle<R, T> {
/// Cancels the task.
///
/// If the task has already completed, calling this method will have no effect.
///
/// When a task is cancelled, its future cannot be polled again and will be dropped instead.
pub fn cancel(&self) {
let ptr = self.raw_proc.as_ptr();
unimplemented!()
}
}
8 changes: 8 additions & 0 deletions lightproc/src/proc_vtable.rs
@@ -0,0 +1,8 @@
use std::task::RawWakerVTable;

pub(crate) struct ProcVTable {
/// The raw waker vtable.
pub(crate) raw_waker: RawWakerVTable,

pub(crate) schedule: unsafe fn(*const ()),
}
Empty file added lightproc/src/state.rs
Empty file.

0 comments on commit a48bec7

Please sign in to comment.