pub struct DispatchLock<'a> { /* private fields */ }Expand description
A lock that prevents concurrent dispatching of a queue.
This lock can be acquired by calling Queue::lock_dispatch.
See the description of Queue for why you might use this.
§Example
let lib = Libwayland::open().unwrap();
let con = lib.connect_to_default_display().unwrap();
let queue = con.create_queue(c"queue name");
let lock = queue.lock_dispatch();
let thread = {
let queue = queue.clone();
thread::spawn(move || {
// this dispatch will not start until the lock is dropped.
queue.dispatch_roundtrip_blocking().unwrap();
})
};
// this dispatch starts immediately since the lock is re-entrant
queue.dispatch_roundtrip_blocking().unwrap();
drop(lock);
thread.join().unwrap();Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for DispatchLock<'a>
impl<'a> !RefUnwindSafe for DispatchLock<'a>
impl<'a> !Send for DispatchLock<'a>
impl<'a> !Sync for DispatchLock<'a>
impl<'a> Unpin for DispatchLock<'a>
impl<'a> !UnwindSafe for DispatchLock<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more