Instance Method


Changes the cancelled state of the receiver to indicate that it should exit.


func cancel()


The semantics of this method are the same as those used for Operation. This method sets state information in the receiver that is then reflected by the isCancelled property. Threads that support cancellation should periodically call the isCancelled method to determine if the thread has in fact been cancelled, and exit if it has been.

For more information about cancellation and operation objects, see Operation.

See Also

Stopping a Thread

class func sleep(until: Date)

Blocks the current thread until the time specified.

class func sleep(forTimeInterval: TimeInterval)

Sleeps the thread for a given time interval.

class func exit()

Terminates the current thread.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software