19 #ifdef OF_HAVE_THREADS 20 # import "threading.h" 23 OF_ASSUME_NONNULL_BEGIN
31 #if defined(OF_HAVE_THREADS) && defined(OF_HAVE_BLOCKS) 54 #ifdef OF_HAVE_THREADS 63 of_thread_attr_t _attr;
64 enum of_thread_running {
65 OF_THREAD_NOT_RUNNING,
67 OF_THREAD_WAITING_FOR_JOIN
70 # ifdef OF_HAVE_BLOCKS 85 # ifdef OF_HAVE_BLOCKS 89 @property OF_NULLABLE_PROPERTY (
readonly, nonatomic)
100 # ifdef OF_HAVE_BLOCKS 146 + (void)sleepUntilDate: (
OFDate *)date;
154 #ifdef OF_HAVE_THREADS 165 + (void)terminateWithObject: (nullable
id)object OF_NO_RETURN;
167 # ifdef OF_HAVE_BLOCKS 233 - (void)setPriority: (
float)priority;
249 - (void)setStackSize: (
size_t)stackSize;
251 -
init OF_UNAVAILABLE;
255 OF_ASSUME_NONNULL_END
OFRunLoop * runLoop()
Returns the run loop for the thread.
Definition: OFThread.m:377
void terminate()
Terminates the current thread, letting it return nil.
Definition: OFThread.m:250
id _Nullable(^ of_thread_block_t)(void)
A block to be executed in a new thread.
Definition: OFThread.h:37
id copy()
Returns the class.
Definition: OFObject.m:1133
A class for handling strings.
Definition: OFString.h:114
OFMutableDictionary * threadDictionary()
Returns a dictionary to store thread-specific data, meaning it returns a different dictionary for eve...
Definition: OFThread.m:175
void handleTermination()
This routine is executed when the thread's main method has finished executing or terminate has been c...
Definition: OFThread.m:331
OFThread * currentThread()
Returns the current thread.
Definition: OFThread.m:165
id init()
Initializes an already allocated object.
Definition: OFObject.m:488
An abstract class for storing and changing objects in a dictionary.
Definition: OFMutableDictionary.h:39
nullable id main()
The main routine of the thread. You need to reimplement this!
Definition: OFThread.m:324
OFThread * mainThread()
Returns the main thread.
Definition: OFThread.m:170
A protocol for the creation of copies.
Definition: OFObject.h:914
A class providing a run loop for the application and its processes.
Definition: OFRunLoop.h:41
double of_time_interval_t
A time interval in seconds.
Definition: OFObject.h:91
instancetype thread()
Creates a new thread.
Definition: OFThread.m:153
void start()
Starts the thread.
Definition: OFThread.m:341
The root class for all other classes inside ObjFW.
Definition: OFObject.h:379
A class for storing, accessing and comparing dates.
Definition: OFDate.h:30
id join()
Joins a thread.
Definition: OFThread.m:362
void yield()
Yields a processor voluntarily and moves the thread to the end of the queue for its priority...
Definition: OFThread.m:240
float priority()
Returns the priority of the thread.
Definition: OFThread.m:396
size_t stackSize()
Returns the stack size of the thread.
Definition: OFThread.m:410
A class which provides portable threads.
Definition: OFThread.h:53
readonly
Definition: OFThread.h:89