@@ -34,14 +34,10 @@ #ifdef OF_HAVE_SCHED_YIELD # include #endif -#if defined(OF_HAVE_THREADS) && defined(__HAIKU__) -# include -#endif - #import "OFThread.h" #import "OFThread+Private.h" #import "OFRunLoop.h" #import "OFList.h" #import "OFDate.h" @@ -115,24 +111,10 @@ [thread release]; return 0; } - -static void -setThreadName(OFThread *thread) -{ -# ifdef __HAIKU__ - OFString *name = thread->_name; - - if (name == nil) - name = [thread className]; - - rename_thread(get_pthread_thread_id(thread->_thread), - [name UTF8String]); -# endif -} #endif @implementation OFThread #ifdef OF_HAVE_THREADS # if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) @@ -329,11 +311,14 @@ if (!of_thread_new(&_thread, callMain, self)) { [self release]; @throw [OFThreadStartFailedException exceptionWithThread: self]; } - setThreadName(self); + if (_name != nil) + of_thread_set_name(_thread, [_name UTF8String]); + else + of_thread_set_name(_thread, class_getName([self class])); } - (id)join { if (_running == OF_THREAD_NOT_RUNNING || !of_thread_join(_thread)) @@ -375,12 +360,17 @@ - (void)setName: (OFString*)name { OF_SETTER(_name, name, true, 1) - if (_running == OF_THREAD_RUNNING) - setThreadName(self); + if (_running == OF_THREAD_RUNNING) { + if (_name != nil) + of_thread_set_name(_thread, [_name UTF8String]); + else + of_thread_set_name(_thread, + class_getName([self class])); + } } - (void)dealloc { if (_running == OF_THREAD_RUNNING)