diff options
Diffstat (limited to 'src/ctxt.rs')
-rw-r--r-- | src/ctxt.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/ctxt.rs b/src/ctxt.rs index 7cd8a74..2fdd182 100644 --- a/src/ctxt.rs +++ b/src/ctxt.rs @@ -1,20 +1,20 @@ -//! Execution context +//! Interrupt / Exception context use core::marker::PhantomData; use core::cell::UnsafeCell; -/// Data local to an execution context +/// Data local to a context pub struct Local<T, Ctxt> - where Ctxt: Token + where Ctxt: Context { _ctxt: PhantomData<Ctxt>, data: UnsafeCell<T>, } impl<T, Ctxt> Local<T, Ctxt> - where Ctxt: Token + where Ctxt: Context { - /// Initializes the local data + /// Initializes context local data pub const fn new(value: T) -> Self { Local { _ctxt: PhantomData, @@ -22,13 +22,13 @@ impl<T, Ctxt> Local<T, Ctxt> } } - /// Acquires a reference to the local data + /// Acquires a reference to the context local data pub fn borrow<'a>(&'static self, _ctxt: &'a Ctxt) -> &'a T { unsafe { &*self.data.get() } } } -unsafe impl<T, Ctxt> Sync for Local<T, Ctxt> where Ctxt: Token {} +unsafe impl<T, Ctxt> Sync for Local<T, Ctxt> where Ctxt: Context {} -/// A unique token that identifies an execution context -pub unsafe trait Token {} +/// A token unique to a context +pub unsafe trait Context {} |