# Struct qutex::QrwLock [−] [src]

    pub struct QrwLock<T> { /* fields omitted */ }

A queue-backed read/write data lock.

As with any queue-backed system, deadlocks must be carefully avoided when interoperating with other queues.

## Methods

### `impl<T> QrwLock<T>`
[src]

#### `pub fn new(val: T) -> QrwLock<T>`
[src]

Creates and returns a new `QrwLock`.

#### `pub fn read(self) -> FutureReadGuard<T>`
[src]

Returns a new `FutureReadGuard` which can be used as a future and will resolve into a `ReadGuard`.

#### `pub fn write(self) -> FutureWriteGuard<T>`
[src]

Returns a new `FutureWriteGuard` which can be used as a future and will resolve into a `WriteGuard`.

#### `pub unsafe fn enqueue_lock_request(&self, req: QrwRequest)`
[src]

Pushes a lock request onto the queue.

#### `pub fn get_mut(&mut self) -> Option<&mut T>`
[src]

Returns a mutable reference to the inner `Vec` if there are currently no other copies of this `QrwLock`.

Since this call borrows the inner lock mutably, no actual locking needs to take place---the mutable borrow statically guarantees no locks exist.

#### `pub fn as_ptr(&self) -> *const T`
[src]

Returns a reference to the inner value.

#### `pub fn as_mut_ptr(&self) -> *mut T`
[src]

Returns a mutable reference to the inner value.

#### `pub unsafe fn process_queues(&self)`
[src]

Pops the next lock request in the queue if possible.

#### `pub unsafe fn upgrade_read_lock(&self) -> Result<(), Receiver<()>>`
[src]

Converts a single read lock (read count of '1') into a write lock.

Returns an error containing a oneshot receiver if there is currently more than one read lock. When the read count reaches one, the receiver channel will be completed (i.e. poll it).

Panics if there are no read locks.

Do not call this method directly unless you are using a custom guard or are otherwise managing the lock state manually. Use `ReadGuard::upgrade` instead.

#### `pub unsafe fn downgrade_write_lock(&self)`
[src]

Converts a write lock into a read lock then processes the queue, allowing additional read requests to acquire locks.

Use `WriteGuard::downgrade` rather than calling this directly.

#### `pub unsafe fn release_read_lock(&self)`
[src]

Decreases the reader count by one and unparks the next requester task in the queue if possible.

If a reader is waiting to be upgraded and the read lock count reaches 1, the upgrade sender will be completed.

#### `pub unsafe fn release_write_lock(&self)`
[src]

Unlocks this (the caller's) lock and unparks the next requester task in the queue if possible.

## Trait Implementations

### `impl<T: Debug> Debug for QrwLock<T>`
[src]

#### `fn fmt(&self, __arg_0: &mut Formatter) -> Result`
[src]

Formats the value using the given formatter. Read more

### `impl<T> From<T> for QrwLock<T>`
[src]

#### `fn from(val: T) -> QrwLock<T>`
[src]

Performs the conversion.

### `impl<T> Clone for QrwLock<T>`
[src]

#### `fn clone(&self) -> QrwLock<T>`
[src]

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`
1.0.0
[src]

Performs copy-assignment from `source`. Read more

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)