Threading

public struct Threading

A wrapper around a variety of threading related functions and classes.

  • Indicates that the call should have no timeout.

    Declaration

    Swift

    public static let noTimeout = 0.0
  • The function type which can be given to Threading.dispatch.

    Declaration

    Swift

    public typealias ThreadClosure = () -> ()
  • A mutex-type thread lock. The lock can be held by only one thread. Other threads attempting to secure the lock while it is held will block. The lock is initialized as being recursive. The locking thread may lock multiple times, but each lock should be accompanied by an unlock.

    See more

    Declaration

    Swift

    public class Lock
  • A thread event object. Inherits from Threading.Lock. The event MUST be locked before wait or signal is called. While inside the wait call, the event is automatically placed in the unlocked state. After wait or signal return the event will be in the locked state and must be unlocked.

    See more

    Declaration

    Swift

    public final class Event: Lock
  • A read-write thread lock. Permits multiple readers to hold the while, while only allowing at most one writer to hold the lock. For a writer to acquire the lock all readers must have unlocked. For a reader to acquire the lock no writers must hold the lock.

    See more

    Declaration

    Swift

    public final class RWLock
  • Block the current thread for the indicated time.

    Declaration

    Swift

    public static func sleep(seconds inSeconds: Double)
  • Queue type indicator.

    See more

    Declaration

    Swift

    public enum QueueType
  • Find or create a queue indicated by name and type.

    Declaration

    Swift

    public static func getQueue(name nam: String, type: QueueType) -> ThreadQueue
  • Call the given closure on the default concurrent queue Returns immediately.

    Declaration

    Swift

    public static func dispatch(closure: Threading.ThreadClosure)