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 94 # ifdef OF_HAVE_BLOCKS 140 + (void)sleepUntilDate: (
OFDate *)date;
148 #ifdef OF_HAVE_THREADS 159 + (void)terminateWithObject: (nullable
id)object OF_NO_RETURN;
161 # ifdef OF_HAVE_BLOCKS 217 - (void)setName: (nullable
OFString *)name;
241 - (void)setPriority: (
float)priority;
257 - (void)setStackSize: (
size_t)stackSize;
259 -
init OF_UNAVAILABLE;
263 OF_ASSUME_NONNULL_END
OFRunLoop * runLoop()
Returns the run loop for the thread.
Definition: OFThread.m:374
void terminate()
Terminates the current thread, letting it return nil.
Definition: OFThread.m:242
id _Nullable(^ of_thread_block_t)(void)
A block to be executed in a new thread.
Definition: OFThread.h:37
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:167
void handleTermination()
This routine is executed when the thread's main method has finished executing or terminate has been c...
Definition: OFThread.m:323
OFThread * currentThread()
Returns the current thread.
Definition: OFThread.m:157
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:316
OFThread * mainThread()
Returns the main thread.
Definition: OFThread.m:162
A protocol for the creation of copies.
Definition: OFObject.h:912
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:145
nullable OFString * name()
Returns the name of the thread or nil if none has been set.
Definition: OFThread.m:393
void start()
Starts the thread.
Definition: OFThread.m:333
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:359
of_thread_block_t threadBlock
Definition: OFThread.h:84
void yield()
Yields a processor voluntarily and moves the thread to the end of the queue for its priority...
Definition: OFThread.m:232
float priority()
Returns the priority of the thread.
Definition: OFThread.m:409
size_t stackSize()
Returns the stack size of the thread.
Definition: OFThread.m:423
A class which provides portable threads.
Definition: OFThread.h:53