00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #import "OFObject.h"
00018 #import "OFList.h"
00019
00020 #import "threading.h"
00021
00025 @interface OFTLSKey: OFObject
00026 {
00027 @public
00028 of_tlskey_t key;
00029 @protected
00030 void (*destructor)(id);
00031 of_list_object_t *listobj;
00032 BOOL initialized;
00033 }
00034
00038 + tlsKey;
00039
00044 + tlsKeyWithDestructor: (void(*)(id))destructor;
00045
00046 + (void)callAllDestructors;
00047
00051 - init;
00052
00057 - initWithDestructor: (void(*)(id))destructor;
00058 @end
00059
00066 @interface OFThread: OFObject
00067 {
00068 id object;
00069 of_thread_t thread;
00070 @public
00071 enum {
00072 OF_THREAD_NOT_RUNNING,
00073 OF_THREAD_RUNNING,
00074 OF_THREAD_WAITING_FOR_JOIN
00075 } running;
00076 id retval;
00077 }
00078
00083 + threadWithObject: (id)obj;
00084
00096 + (id)setObject: (id)obj
00097 forTLSKey: (OFTLSKey*)key;
00098
00107 + (id)objectForTLSKey: (OFTLSKey*)key;
00108
00112 + (OFThread*)currentThread;
00113
00117 + (void)sleepForNMilliseconds: (unsigned int)msecs;
00118
00123 + (void)yield;
00124
00128 + (void)terminate;
00129
00135 + (void)terminateWithObject: (id)obj;
00136
00141 - initWithObject: (id)obj;
00142
00151 - (id)main;
00152
00157 - (void)handleTermination;
00158
00162 - (void)start;
00163
00169 - (id)join;
00170 @end
00171
00175 @interface OFMutex: OFObject
00176 {
00177 of_mutex_t mutex;
00178 BOOL initialized;
00179 }
00180
00184 + mutex;
00185
00189 - (void)lock;
00190
00197 - (BOOL)tryLock;
00198
00202 - (void)unlock;
00203 @end