@@ -49,17 +49,18 @@ # include <3ds/svc.h> #endif #import "OFThread.h" #import "OFThread+Private.h" -#import "OFRunLoop.h" -#import "OFString.h" -#import "OFList.h" +#import "OFAutoreleasePool+Private.h" +#import "OFAutoreleasePool.h" #import "OFDate.h" #import "OFDictionary.h" -#import "OFAutoreleasePool.h" -#import "OFAutoreleasePool+Private.h" +#import "OFList.h" +#import "OFLocalization.h" +#import "OFRunLoop.h" +#import "OFString.h" #ifdef OF_WINDOWS # include #endif @@ -269,10 +270,26 @@ [thread release]; of_thread_exit(); } + ++ (void)setName: (OFString *)name +{ + [[OFThread currentThread] setName: name]; + + if (name != nil) + of_thread_set_name( + [name cStringWithEncoding: [OFLocalization encoding]]); + else + of_thread_set_name(class_getName([self class])); +} + ++ (OFString *)name +{ + return [[OFThread currentThread] name]; +} + (void)of_createMainThread { mainThread = [[OFThread alloc] init]; mainThread->_thread = of_thread_current(); @@ -350,11 +367,12 @@ [self release]; @throw [OFThreadStartFailedException exceptionWithThread: self]; } if (_name != nil) - of_thread_set_name([_name UTF8String]); + of_thread_set_name( + [_name cStringWithEncoding: [OFLocalization encoding]]); else of_thread_set_name(class_getName([self class])); } - (id)join