Type Method

exit()

Terminates the current thread.

Declaration

class func exit()

Discussion

This method uses the current class method to access the current thread. Before exiting the thread, this method posts the NSThreadWillExit with the thread being exited to the default notification center. Because notifications are delivered synchronously, all observers of NSThreadWillExit are guaranteed to receive the notification before the thread exits.

Invoking this method should be avoided as it does not give your thread a chance to clean up any resources it allocated during its execution.

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.

func cancel()

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

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