pub enum DeadlockPolicy {
Allow,
Pessimistic,
Timeout(Duration),
}
Expand description
Policies to deal with potential deadlocks
As Godot allows mutable pointer aliasing, doing certain things in exported method bodies may
lead to the engine calling another method on owner
, leading to another locking attempt
within the same thread:
- Variant calls on anything may dispatch to a script method.
- Anything that could emit signals, that are connected to in a non-deferred manner.
As there is no universal way to deal with such situations, behavior of locking wrappers can be customized using this enum.
Variants§
Allow
Block on all locks. Deadlocks are possible.
Pessimistic
Never block on any locks. Methods will return Nil immediately if the lock isn’t available. Deadlocks are prevented.
Timeout(Duration)
Block on locks for at most Duration
. Methods return Nil on timeout. Deadlocks are
prevented.
Trait Implementations§
Source§impl Clone for DeadlockPolicy
impl Clone for DeadlockPolicy
Source§fn clone(&self) -> DeadlockPolicy
fn clone(&self) -> DeadlockPolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for DeadlockPolicy
impl Debug for DeadlockPolicy
Source§impl Hash for DeadlockPolicy
impl Hash for DeadlockPolicy
Source§impl Ord for DeadlockPolicy
impl Ord for DeadlockPolicy
Source§fn cmp(&self, other: &DeadlockPolicy) -> Ordering
fn cmp(&self, other: &DeadlockPolicy) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for DeadlockPolicy
impl PartialEq for DeadlockPolicy
Source§impl PartialOrd for DeadlockPolicy
impl PartialOrd for DeadlockPolicy
impl Copy for DeadlockPolicy
impl Eq for DeadlockPolicy
impl StructuralPartialEq for DeadlockPolicy
Auto Trait Implementations§
impl Freeze for DeadlockPolicy
impl RefUnwindSafe for DeadlockPolicy
impl Send for DeadlockPolicy
impl Sync for DeadlockPolicy
impl Unpin for DeadlockPolicy
impl UnwindSafe for DeadlockPolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.