[][src]Struct sunrise_kernel::ipc::NAMED_PORTS

struct NAMED_PORTS {
    __private_field: (),
}

Fields

__private_field: ()

Methods from Deref<Target = SpinRwLock<HashMap<String, ClientPort>>>

pub fn read(&self) -> RwLockReadGuard<T>

Locks this rwlock with shared read access, blocking the current thread until it can be acquired.

The calling thread will be blocked until there are no more writers which hold the lock. There may be other readers currently inside the lock when this method returns. This method does not provide any guarantees with respect to the ordering of whether contentious readers or writers will acquire the lock first.

Returns an RAII guard which will release this thread's shared access once it is dropped.

let mylock = spin::RwLock::new(0);
{
    let mut data = mylock.read();
    // The lock is now locked and the data can be read
    println!("{}", *data);
    // The lock is dropped
}

pub fn try_read(&self) -> Option<RwLockReadGuard<T>>

Attempt to acquire this lock with shared read access.

This function will never block and will return immediately if read would otherwise succeed. Returns Some of an RAII guard which will release the shared access of this thread when dropped, or None if the access could not be granted. This method does not provide any guarantees with respect to the ordering of whether contentious readers or writers will acquire the lock first.

let mylock = spin::RwLock::new(0);
{
    match mylock.try_read() {
        Some(data) => {
            // The lock is now locked and the data can be read
            println!("{}", *data);
            // The lock is dropped
        },
        None => (), // no cigar
    };
}

pub unsafe fn force_read_decrement(&self)

Force decrement the reader count.

This is extremely unsafe if there are outstanding RwLockReadGuards live, or if called more times than read has been called, but can be useful in FFI contexts where the caller doesn't know how to deal with RAII. The underlying atomic operation uses Ordering::Release.

pub unsafe fn force_write_unlock(&self)

Force unlock exclusive write access.

This is extremely unsafe if there are outstanding RwLockWriteGuards live, or if called when there are current readers, but can be useful in FFI contexts where the caller doesn't know how to deal with RAII. The underlying atomic operation uses Ordering::Release.

pub fn write(&self) -> RwLockWriteGuard<T>

Lock this rwlock with exclusive write access, blocking the current thread until it can be acquired.

This function will not return while other writers or other readers currently have access to the lock.

Returns an RAII guard which will drop the write access of this rwlock when dropped.

let mylock = spin::RwLock::new(0);
{
    let mut data = mylock.write();
    // The lock is now locked and the data can be written
    *data += 1;
    // The lock is dropped
}

pub fn try_write(&self) -> Option<RwLockWriteGuard<T>>

Attempt to lock this rwlock with exclusive write access.

This function does not ever block, and it will return None if a call to write would otherwise block. If successful, an RAII guard is returned.

let mylock = spin::RwLock::new(0);
{
    match mylock.try_write() {
        Some(mut data) => {
            // The lock is now locked and the data can be written
            *data += 1;
            // The lock is implicitly dropped
        },
        None => (), // no cigar
    };
}

pub fn upgradeable_read(&self) -> RwLockUpgradeableGuard<T>

Obtain a readable lock guard that can later be upgraded to a writable lock guard. Upgrades can be done through the RwLockUpgradeableGuard::upgrade method.

pub fn try_upgradeable_read(&self) -> Option<RwLockUpgradeableGuard<T>>

Tries to obtain an upgradeable lock guard.

Trait Implementations

impl Deref for NAMED_PORTS[src]

type Target = SpinRwLock<HashMap<String, ClientPort>>

The resulting type after dereferencing.

impl LazyStatic for NAMED_PORTS[src]

Auto Trait Implementations

impl RefUnwindSafe for NAMED_PORTS

impl Send for NAMED_PORTS

impl Sync for NAMED_PORTS

impl Unpin for NAMED_PORTS

impl UnwindSafe for NAMED_PORTS

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.