This is NSThread.rtf in view mode; [Download] [Up]
paperh18648 margl-907 margr0 margt0 margb0 fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1994 by NeXT Computer, Inc. All Rights Reserved. s4 li100 fi0 ri1007 ql f0 b fs36 fs100 fs36 NSThread pard s11 li2872 fi-2771 ri1007 ql tx2872 f1 b0 fs28 fs48 fs28 f0 b fs24 Inherits From:tab b0 fs28 f1 NSObject fs20 fs28 s6 f0 b fs24 Conforms To:tab b0 fs28 f1 NSObject (NSObject) fs20 fs28 s7 f0 b fs24 Declared In:tab b0 fs28 f1 Foundation/NSThread.h fs20 fs28 pard s16 li100 fi0 ri1007 ql f0 b fs28 fs20 fs28 Class Description fs14 fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 fs28 An NSThread object controls a thread of execution. You use an NSThread when you want to terminate or delay a thread or you want a new thread. fs16 fs28 A i threadi0 is an executable unit. A i taski0 is made up of one or more threads. Each thread has its own execution stack and is capable of independent I/O. All threads share the virtual memory address space and communication rights of their task. When a thread is started, it is i detachedi0 from its initiating thread. The new thread runs independently. That is, the initiating thread does not know the new thread'27s state. fs16 fs28 To obtain an NSThread object that represents your current thread of execution, use the b currentThreadb0 method. To obtain an NSThread object that will create a new thread of execution, use b detachNewThreadSelector:toTarget:withObject:b0 . This method sends the specified Objective C message to the specified object in its own thread of execution. You use the NSThread object returned by these methods if you ever need to delay or terminate that thread of execution. fs16 fs28 When you use b detachNewThreadSelector:toTarget:withObject:b0 , your application becomes multithreaded. At any time, you can send b isMultiThreadedb0 to find out if the application is multithreaded, that is, if a thread was ever detached from the current thread. b isMultiThreadedb0 returns YES even if the detached thread has completed execution. fs16 fs28 pard s16 li100 fi0 ri1007 ql f0 b fs24 fs28 Creating an NSThread fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 + (NSThread *)b currentThreadb0 tab Returns an object representing the current thread of execution. fi-6552 fs16 fs28 fi-6552 + (void)b detachNewThreadSelector:b0 (SEL)i aSelectori0 tab Creates and starts a new NSThread for the message s9 li7030 fi-6553 fi-5796 b toTarget:b0 (id)i aTargeti0 tab tab b [aTarget aSelector:anArgument]b0 . The method b withObject:b0 (id)i anArgumenti0 tab tab i aSelectori0 may take only one argument and may not have a return value. If this is the first thread detached from the current thread, this method posts the notification NSBecomingMultiThreaded will the nil object to the default notification center. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Querying a Thread fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 + (BOOL)b isMultiThreadedb0 tab Returns YES if a thread was ever detached (regardless of if the detached thread is still running). fi-6552 fs16 fs28 fi-6552 {f3 -} (NSMutableDictionary *)b threadDictionaryb0 tab Returns the NSThread'27s dictionary, allowing you to add data specific to the receiving NSThread. This essentially allows user-defined NSThread variables. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Delaying a Thread fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 + (void)b sleepUntilDate:b0 (NSDate *)i datei0 tab Has the receiving NSThread sleep until the time specified by i datei0 . No input or timers will be processed in this interval. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Terminating a Thread fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 + (void)b exitb0 tab Terminates the thread represented by the calling object. Before exiting that thread, this method posts the NSThreadExiting notification with the thread being exited to the default notification center. }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.