@@ -85,11 +85,11 @@ # import "tlskey.h" # if defined(OF_AMIGAOS) && defined(OF_HAVE_SOCKETS) # import "socket.h" # endif -static of_tlskey_t threadSelfKey; +static OFTLSKey threadSelfKey; static OFThread *mainThread; #elif defined(OF_HAVE_SOCKETS) static OFDNSResolver *DNSResolver; #endif @@ -99,11 +99,11 @@ callMain(id object) { OFThread *thread = (OFThread *)object; OFString *name; - if (of_tlskey_set(threadSelfKey, thread) != 0) + if (OFTLSKeySet(threadSelfKey, thread) != 0) @throw [OFInitializationFailedException exceptionWithClass: thread.class]; #ifndef OF_OBJFW_RUNTIME thread->_pool = objc_autoreleasePoolPush(); @@ -162,11 +162,11 @@ + (void)initialize { if (self != [OFThread class]) return; - if (of_tlskey_new(&threadSelfKey) != 0) + if (OFTLSKeyNew(&threadSelfKey) != 0) @throw [OFInitializationFailedException exceptionWithClass: self]; } + (instancetype)thread @@ -181,11 +181,11 @@ } # endif + (OFThread *)currentThread { - return of_tlskey_get(threadSelfKey); + return OFTLSKeyGet(threadSelfKey); } + (OFThread *)mainThread { return mainThread; @@ -194,16 +194,16 @@ + (bool)isMainThread { if (mainThread == nil) return false; - return (of_tlskey_get(threadSelfKey) == mainThread); + return (OFTLSKeyGet(threadSelfKey) == mainThread); } + (OFMutableDictionary *)threadDictionary { - OFThread *thread = of_tlskey_get(threadSelfKey); + OFThread *thread = OFTLSKeyGet(threadSelfKey); if (thread == nil) return nil; if (thread->_threadDictionary == nil) @@ -215,11 +215,11 @@ #ifdef OF_HAVE_SOCKETS + (OFDNSResolver *)DNSResolver { # ifdef OF_HAVE_THREADS - OFThread *thread = of_tlskey_get(threadSelfKey); + OFThread *thread = OFTLSKeyGet(threadSelfKey); if (thread == nil) return nil; if (thread->_DNSResolver == nil) @@ -317,11 +317,11 @@ OF_UNREACHABLE } + (void)terminateWithObject: (id)object { - OFThread *thread = of_tlskey_get(threadSelfKey); + OFThread *thread = OFTLSKeyGet(threadSelfKey); if (thread == mainThread) @throw [OFInvalidArgumentException exception]; OF_ENSURE(thread != nil); @@ -352,11 +352,11 @@ { mainThread = [[OFThread alloc] init]; mainThread->_thread = of_thread_current(); mainThread->_running = OF_THREAD_RUNNING; - if (of_tlskey_set(threadSelfKey, mainThread) != 0) + if (OFTLSKeySet(threadSelfKey, mainThread) != 0) @throw [OFInitializationFailedException exceptionWithClass: self]; } - (instancetype)init