Instance Method

cancel()

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

Declaration

func cancel()

Discussion

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.