Struct mupdf_sys::fz_locks_context[][src]

#[repr(C)]pub struct fz_locks_context {
    pub user: *mut c_void,
    pub lock: Option<unsafe extern "C" fn(user: *mut c_void, lock: c_int)>,
    pub unlock: Option<unsafe extern "C" fn(user: *mut c_void, lock: c_int)>,
}

Locking functions

MuPDF is kept deliberately free of any knowledge of particular threading systems. As such, in order for safe multi-threaded operation, we rely on callbacks to client provided functions.

A client is expected to provide FZ_LOCK_MAX number of mutexes, and a function to lock/unlock each of them. These may be recursive mutexes, but do not have to be.

If a client does not intend to use multiple threads, then it may pass NULL instead of a lock structure.

In order to avoid deadlocks, we have one simple rule internally as to how we use locks: We can never take lock n when we already hold any lock i, where 0 <= i <= n. In order to verify this, we have some debugging code, that can be enabled by defining FITZ_DEBUG_LOCKING.

Fields

user: *mut c_voidlock: Option<unsafe extern "C" fn(user: *mut c_void, lock: c_int)>unlock: Option<unsafe extern "C" fn(user: *mut c_void, lock: c_int)>

Trait Implementations

impl Clone for fz_locks_context[src]

impl Copy for fz_locks_context[src]

impl Debug for fz_locks_context[src]

Auto Trait Implementations

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.