-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
719b3c5
commit a48bec7
Showing
6 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
mod lightproc; | ||
mod proc_handle; | ||
mod proc_data; | ||
mod proc_vtable; | ||
mod state; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
pub struct LightProc { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.