[src]

Module sync::one

A "once initialization" primitive

This primitive is meant to be used to run one-time initialization. An example use case would be for initializing an FFI library.

Once

A type which can be used to run a one-time global initialization. This type is unsafe to use because it is built on top of the Mutex in this module. It does not know whether the currently running task is in a green or native context, and a blocking mutex should not be used under normal circumstances on a green task.

pub static ONCE_INIT: Once =
Once {
    mutex: MUTEX_INIT,
    cnt: atomics::INIT_ATOMIC_INT,
    lock_cnt: atomics::INIT_ATOMIC_INT,
}

Initialization value for static Once values.