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
00022 @class OFDate;
00023
00027 @interface OFTLSKey: OFObject
00028 {
00029 @public
00030 of_tlskey_t key;
00031
00032 #if !defined(__GNUC__) || __GNUC__ != 4 || __GNUC_MINOR__ != 4 || \
00033 __GNUC_PATCHLEVEL__ != 4
00034 @protected
00035 #endif
00036 void (*destructor)(id);
00037 of_list_object_t *listobj;
00038 BOOL initialized;
00039 }
00040
00044 + TLSKey;
00045
00050 + TLSKeyWithDestructor: (void(*)(id))destructor;
00051
00052 + (void)callAllDestructors;
00053
00057 - init;
00058
00063 - initWithDestructor: (void(*)(id))destructor;
00064 @end
00065
00072 @interface OFThread: OFObject
00073 {
00074 id object;
00075 of_thread_t thread;
00076 @public
00077 enum {
00078 OF_THREAD_NOT_RUNNING,
00079 OF_THREAD_RUNNING,
00080 OF_THREAD_WAITING_FOR_JOIN
00081 } running;
00082 id retval;
00083 }
00084
00088 + thread;
00089
00094 + threadWithObject: (id)obj;
00095
00106 + (void)setObject: (id)obj
00107 forTLSKey: (OFTLSKey*)key;
00108
00117 + (id)objectForTLSKey: (OFTLSKey*)key;
00118
00122 + (OFThread*)currentThread;
00123
00129 + (void)sleepForTimeInterval: (int64_t)sec;
00130
00137 + (void)sleepForTimeInterval: (int64_t)sec
00138 microseconds: (uint32_t)usec;
00139
00143 + (void)sleepUntilDate: (OFDate*)date;
00144
00149 + (void)yield;
00150
00154 + (void)terminate;
00155
00161 + (void)terminateWithObject: (id)obj;
00162
00167 - initWithObject: (id)obj;
00168
00177 - (id)main;
00178
00183 - (void)handleTermination;
00184
00188 - (void)start;
00189
00195 - (id)join;
00196 @end
00197
00201 @interface OFMutex: OFObject
00202 {
00203 of_mutex_t mutex;
00204 BOOL initialized;
00205 }
00206
00210 + mutex;
00211
00215 - (void)lock;
00216
00223 - (BOOL)tryLock;
00224
00228 - (void)unlock;
00229 @end
00230
00234 @interface OFCondition: OFMutex
00235 {
00236 of_condition_t condition;
00237 BOOL cond_initialized;
00238 }
00239
00243 + condition;
00244
00249 - (void)wait;
00250
00254 - (void)signal;
00255
00259 - (void)broadcast;
00260 @end