27OF_ASSUME_NONNULL_BEGIN
38#if defined(OF_HAVE_THREADS) && defined(OF_HAVE_BLOCKS)
70 OFPlainThread _thread;
71 OFPlainThreadAttributes _attr;
73 OFThreadStateNotRunning,
75 OFThreadStateWaitingForJoin
77# ifndef OF_OBJFW_RUNTIME
85 bool _supportsSockets;
89# ifdef OF_HAVE_SOCKETS
96#ifdef OF_HAVE_CLASS_PROPERTIES
97# ifdef OF_HAVE_THREADS
98@property (
class, readonly, nullable, nonatomic)
OFThread *currentThread;
99@property (
class, readonly, nullable, nonatomic)
OFThread *mainThread;
100@property (
class, readonly, nonatomic)
bool isMainThread;
101@property (
class, readonly, nullable, nonatomic)
103@property (
class, nullable, copy, nonatomic)
OFString *name;
105# ifdef OF_HAVE_SOCKETS
106@property (
class, readonly, nonatomic)
OFDNSResolver *DNSResolver;
110#ifdef OF_HAVE_THREADS
119@property OF_NULLABLE_PROPERTY (copy)
OFString *name;
121# ifdef OF_HAVE_BLOCKS
145@property (nonatomic)
float priority;
177# ifdef OF_HAVE_BLOCKS
217#ifdef OF_HAVE_SOCKETS
242+ (void)sleepUntilDate: (
OFDate *)date;
250#if defined(OF_WII) || defined(OF_NINTENDO_DS) || defined(OF_NINTENDO_3DS) || \
260#ifdef OF_HAVE_THREADS
272+ (void)terminateWithObject: (nullable
id)object OF_NO_RETURN;
282+ (void)setName: (nullable
OFString *)name;
291# ifdef OF_HAVE_BLOCKS
332- (instancetype)
init OF_UNAVAILABLE;
double OFTimeInterval
A time interval in seconds.
Definition OFObject.h:154
id(^ OFThreadBlock)(void)
A block to be executed in a new thread.
Definition OFThread.h:44
A class for resolving DNS names.
Definition OFDNSResolver.h:132
A class for storing, accessing and comparing dates.
Definition OFDate.h:34
An abstract class for storing and changing objects in a dictionary.
Definition OFMutableDictionary.h:48
The root class for all other classes inside ObjFW.
Definition OFObject.h:692
instancetype init()
Initializes an already allocated object.
Definition OFObject.m:696
A class providing a run loop for the application and its processes.
Definition OFRunLoop.h:66
A class for handling strings.
Definition OFString.h:143
A class which provides portable threads.
Definition OFThread.h:66
void waitForVerticalBlank()
Waits for the vertical blank.
id join()
Joins a thread.
Definition OFThread.m:481
float priority
The priority of the thread.
Definition OFThread.m:524
void terminate()
Terminates the current thread, letting it return nil.
Definition OFThread.m:347
instancetype thread()
Creates a new thread.
Definition OFThread.m:194
nullable OFMutableDictionary * threadDictionary()
Returns a dictionary to store thread-specific data, meaning it returns a different dictionary for eve...
Definition OFThread.m:224
void handleTermination()
This routine is executed when the thread's main method has finished executing or terminate has been c...
Definition OFThread.m:440
void start()
Starts the thread.
Definition OFThread.m:455
bool supportsSockets
Whether the thread supports sockets.
Definition OFThread.m:552
nullable id main()
The main routine of the thread. You need to reimplement this!
Definition OFThread.m:433
nullable OFDNSResolver * DNSResolver()
Returns the DNS resolver for the current thread.
Definition OFThread.m:239
void yield()
Yields a processor voluntarily and moves the thread to the end of the queue for its priority.
Definition OFThread.m:320
bool isMainThread()
Returns whether the current thread is the main thread.
Definition OFThread.m:216
nullable OFThread * mainThread()
Returns the main thread.
Definition OFThread.m:211
nullable OFThread * currentThread()
Returns the current thread.
Definition OFThread.m:206
OFString * name
The name for the thread to use when starting it.
Definition OFThread.m:385
OFRunLoop * runLoop
The run loop for the thread.
Definition OFThread.m:504
size_t stackSize
The stack size of the thread.
Definition OFThread.m:538
OFThreadBlock block
The block to execute in the thread.
Definition OFThread.h:125
A protocol for the creation of copies.
Definition OFObject.h:1354