pub struct Counter {
data: Arc<SharedCounterData>,
id: String,
nonblocking: AtomicBool,
}Expand description
Counter object for eventfd-like IPC
Fields§
§data: Arc<SharedCounterData>Shared data
id: StringUnique identifier for debugging
nonblocking: AtomicBoolNon-blocking flag
Implementations§
Source§impl Counter
impl Counter
Sourcepub fn create_pair(
initval: u32,
semaphore: bool,
) -> (KernelObject, KernelObject)
pub fn create_pair( initval: u32, semaphore: bool, ) -> (KernelObject, KernelObject)
Create a new counter pair as KernelObjects (returns same counter twice for dup semantics)
Sourcepub fn create_kernel_object(initval: u32, flags: u32) -> KernelObject
pub fn create_kernel_object(initval: u32, flags: u32) -> KernelObject
Create a single counter as KernelObject
Sourcefn do_read(&self, buffer: &mut [u8]) -> Result<usize, StreamError>
fn do_read(&self, buffer: &mut [u8]) -> Result<usize, StreamError>
Read the counter value (8 bytes)
Sourcefn do_write(&self, buffer: &[u8]) -> Result<usize, StreamError>
fn do_write(&self, buffer: &[u8]) -> Result<usize, StreamError>
Write to the counter (8 bytes)
Trait Implementations§
Source§impl CloneOps for Counter
impl CloneOps for Counter
Source§fn custom_clone(&self) -> KernelObject
fn custom_clone(&self) -> KernelObject
Perform a custom clone operation and return the cloned object Read more
Source§impl CounterObject for Counter
impl CounterObject for Counter
Source§fn is_semaphore(&self) -> bool
fn is_semaphore(&self) -> bool
Check if this is a semaphore mode counter
Source§impl Selectable for Counter
impl Selectable for Counter
Source§fn current_ready(&self, interest: ReadyInterest) -> ReadySet
fn current_ready(&self, interest: ReadyInterest) -> ReadySet
Return current readiness for the given interest set.
Source§fn wait_until_ready(
&self,
interest: ReadyInterest,
trapframe: &mut Trapframe,
timeout_ticks: Option<u64>,
) -> SelectWaitOutcome
fn wait_until_ready( &self, interest: ReadyInterest, trapframe: &mut Trapframe, timeout_ticks: Option<u64>, ) -> SelectWaitOutcome
Block the current task using the provided trapframe until the interest
becomes ready or the optional timeout (in ticks) expires. Read more
Source§fn set_nonblocking(&self, enabled: bool)
fn set_nonblocking(&self, enabled: bool)
Enable or disable non-blocking I/O semantics on this object. Read more
Source§fn is_nonblocking(&self) -> bool
fn is_nonblocking(&self) -> bool
Query whether non-blocking I/O semantics are enabled on this object.
Auto Trait Implementations§
impl !Freeze for Counter
impl !RefUnwindSafe for Counter
impl Send for Counter
impl Sync for Counter
impl Unpin for Counter
impl !UnwindSafe for Counter
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)