Contents

lock(before:)

Attempts to acquire a lock before a specified moment in time.

Declaration

func lock(before limit: Date) -> Bool

Parameters

  • limit:

    The date by which the lock must be acquired or the attempt will time out.

Return Value

true if the lock is acquired within the time limit, false otherwise.

Discussion

The condition associated with the receiver isn’t taken into account in this operation. This method blocks the thread’s execution until the receiver acquires the lock or limit is reached.

See Also

Acquiring and Releasing a Lock