Skip to main content

LockBound

Struct LockBound 

Source
pub struct LockBound<T> { /* private fields */ }
Expand description

A value confined to the compositor lock: an object of the server side that is not part of the graph of the server compositor.

Upstream an object of the render interface (an imported GPU image, the feature that imports it, the context it belongs to) is created at the request of the UI thread, then used and disposed by jobs of the render thread; the garbage collector shares it. Here such an object is an Rc, so it is bound to the lock under which every job runs: the value is reached with the server compositor in hand, which a thread only has while it is inside the lock (or, in the mode without a second thread, while it is the one thread of the compositor), and it is dropped inside the lock. Unlike a ThreadBound it does not depend on the thread: both the render thread and the thread of the compositor reach it, one at a time.

Where the graph is confined to the render thread (LockedServerCompositor::confine_to_current_thread) the value is still reached by both threads under the lock, for what upstream reads from the UI thread, but only the render thread drops it: dropped by another thread it is leaked.

Implementations§

Source§

impl<T> LockBound<T>

Source

pub fn get<'a>(&'a self, server: &'a ServerCompositor) -> &'a T

The value, for a caller that is inside the compositor lock: server is what a job receives and what with hands out.

§Panics

When server is not the server compositor the value is bound to.

Trait Implementations§

Source§

impl<T> Drop for LockBound<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<T> Send for LockBound<T>

Source§

impl<T> Sync for LockBound<T>

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for LockBound<T>

§

impl<T> !UnwindSafe for LockBound<T>

§

impl<T> Freeze for LockBound<T>
where ManuallyDrop<T>: Freeze,

§

impl<T> Unpin for LockBound<T>
where ManuallyDrop<T>: Unpin,

§

impl<T> UnsafeUnpin for LockBound<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.