@@ -109,14 +109,14 @@ thread->_pool = objc_autoreleasePoolPush(); #endif name = thread.name; if (name != nil) - of_thread_set_name( + OFSetThreadName( [name cStringWithEncoding: [OFLocale encoding]]); else - of_thread_set_name(object_getClassName(thread)); + OFSetThreadName(object_getClassName(thread)); #if defined(OF_AMIGAOS) && defined(OF_HAVE_SOCKETS) if (thread.supportsSockets) if (!of_socket_init()) @throw [OFInitializationFailedException @@ -147,11 +147,11 @@ #if defined(OF_AMIGAOS) && !defined(OF_MORPHOS) && defined(OF_HAVE_SOCKETS) if (thread.supportsSockets) of_socket_deinit(); #endif - thread->_running = OF_THREAD_WAITING_FOR_JOIN; + thread->_running = OFThreadStateWaitingForJoin; [thread release]; } @synthesize name = _name; @@ -335,14 +335,14 @@ + (void)setName: (OFString *)name { [OFThread currentThread].name = name; if (name != nil) - of_thread_set_name( + OFSetThreadName( [name cStringWithEncoding: [OFLocale encoding]]); else - of_thread_set_name(class_getName([self class])); + OFSetThreadName(class_getName([self class])); } + (OFString *)name { return [OFThread currentThread].name; @@ -349,12 +349,12 @@ } + (void)of_createMainThread { mainThread = [[OFThread alloc] init]; - mainThread->_thread = of_thread_current(); - mainThread->_running = OF_THREAD_RUNNING; + mainThread->_thread = OFCurrentPlainThread(); + mainThread->_running = OFThreadStateRunning; if (OFTLSKeySet(threadSelfKey, mainThread) != 0) @throw [OFInitializationFailedException exceptionWithClass: self]; } @@ -362,11 +362,11 @@ - (instancetype)init { self = [super init]; @try { - if (of_thread_attr_init(&_attr) != 0) + if (OFPlainThreadAttributesInit(&_attr) != 0) @throw [OFInitializationFailedException exceptionWithClass: self.class]; } @catch (id e) { [self release]; @throw e; @@ -415,24 +415,24 @@ - (void)start { int error; - if (_running == OF_THREAD_RUNNING) + if (_running == OFThreadStateRunning) @throw [OFThreadStillRunningException exceptionWithThread: self]; - if (_running == OF_THREAD_WAITING_FOR_JOIN) { - of_thread_detach(_thread); + if (_running == OFThreadStateWaitingForJoin) { + OFPlainThreadDetach(_thread); [_returnValue release]; } [self retain]; - _running = OF_THREAD_RUNNING; + _running = OFThreadStateRunning; - if ((error = of_thread_new(&_thread, [_name cStringWithEncoding: + if ((error = OFPlainThreadNew(&_thread, [_name cStringWithEncoding: [OFLocale encoding]], callMain, self, &_attr)) != 0) { [self release]; @throw [OFThreadStartFailedException exceptionWithThread: self errNo: error]; @@ -441,20 +441,20 @@ - (id)join { int error; - if (_running == OF_THREAD_NOT_RUNNING) + if (_running == OFThreadStateNotRunning) @throw [OFThreadJoinFailedException exceptionWithThread: self errNo: EINVAL]; - if ((error = of_thread_join(_thread)) != 0) + if ((error = OFPlainThreadJoin(_thread)) != 0) @throw [OFThreadJoinFailedException exceptionWithThread: self errNo: error]; - _running = OF_THREAD_NOT_RUNNING; + _running = OFThreadStateNotRunning; return _returnValue; } - (id)copy @@ -486,11 +486,11 @@ return _attr.priority; } - (void)setPriority: (float)priority { - if (_running == OF_THREAD_RUNNING) + if (_running == OFThreadStateRunning) @throw [OFThreadStillRunningException exceptionWithThread: self]; _attr.priority = priority; } @@ -500,11 +500,11 @@ return _attr.stackSize; } - (void)setStackSize: (size_t)stackSize { - if (_running == OF_THREAD_RUNNING) + if (_running == OFThreadStateRunning) @throw [OFThreadStillRunningException exceptionWithThread: self]; _attr.stackSize = stackSize; } @@ -514,29 +514,29 @@ return _supportsSockets; } - (void)setSupportsSockets: (bool)supportsSockets { - if (_running == OF_THREAD_RUNNING) + if (_running == OFThreadStateRunning) @throw [OFThreadStillRunningException exceptionWithThread: self]; _supportsSockets = supportsSockets; } - (void)dealloc { - if (_running == OF_THREAD_RUNNING) + if (_running == OFThreadStateRunning) @throw [OFThreadStillRunningException exceptionWithThread: self]; /* * We should not be running anymore, but call detach in order to free * the resources. */ - if (_running == OF_THREAD_WAITING_FOR_JOIN) - of_thread_detach(_thread); + if (_running == OFThreadStateWaitingForJoin) + OFPlainThreadDetach(_thread); [_returnValue release]; # ifdef OF_HAVE_BLOCKS [_threadBlock release]; # endif