Lock
A threading lock based on libpthread
instead of libdispatch
.
This declaration has been renamed to NIOLock.
This declaration is deprecated.
final class Lock
This object provides a lock on top of a single pthread_mutex_t
. This kind of lock is safe to use with libpthread
-based threading models, such as the one used by NIO. On Windows, the lock is based on the substantially similar SRWLOCK
type.
Citizens in NIOConcurrencyHelpers
Conformances
protocol Sendable
A type whose values can safely be passed across concurrency domains by copying.
Type members
Show obsolete interfaces (1)
Hide obsolete interfaces
init(
) Create a new lock.
Instance members
Show obsolete interfaces (4)
Hide obsolete interfaces
func lock(
) Acquire the lock.
func unlock(
) Release the lock.
func withLock<T>(() throws -> T
) rethrows -> T Acquire the lock for the duration of the given block.
func withLockVoid(() throws -> Void
) rethrows