ObjFW  Diff

Differences From Artifact [e635f40c39]:

To Artifact [2f9aa72b9d]:


47
48
49
50
51
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67

#ifdef OF_NINTENDO_3DS
# include <3ds/svc.h>
#endif

#import "OFThread.h"
#import "OFThread+Private.h"
#import "OFRunLoop.h"
#import "OFString.h"
#import "OFList.h"
#import "OFDate.h"
#import "OFDictionary.h"

#import "OFAutoreleasePool.h"
#import "OFAutoreleasePool+Private.h"

#ifdef OF_WINDOWS
# include <windows.h>
#endif

#ifdef OF_NINTENDO_DS
# define asm __asm__







|
|
|
|
|
>
|
|







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

#ifdef OF_NINTENDO_3DS
# include <3ds/svc.h>
#endif

#import "OFThread.h"
#import "OFThread+Private.h"
#import "OFAutoreleasePool+Private.h"
#import "OFAutoreleasePool.h"
#import "OFDate.h"
#import "OFDictionary.h"
#import "OFList.h"
#import "OFLocalization.h"
#import "OFRunLoop.h"
#import "OFString.h"

#ifdef OF_WINDOWS
# include <windows.h>
#endif

#ifdef OF_NINTENDO_DS
# define asm __asm__
267
268
269
270
271
272
273
















274
275
276
277
278
279
280

	[OFAutoreleasePool of_handleThreadTermination];

	[thread release];

	of_thread_exit();
}

















+ (void)of_createMainThread
{
	mainThread = [[OFThread alloc] init];
	mainThread->_thread = of_thread_current();

	if (!of_tlskey_set(threadSelfKey, mainThread))







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297

	[OFAutoreleasePool of_handleThreadTermination];

	[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();

	if (!of_tlskey_set(threadSelfKey, mainThread))
348
349
350
351
352
353
354
355

356
357
358
359
360
361
362

	if (!of_thread_new(&_thread, callMain, self, &_attr)) {
		[self release];
		@throw [OFThreadStartFailedException exceptionWithThread: self];
	}

	if (_name != nil)
		of_thread_set_name([_name UTF8String]);

	else
		of_thread_set_name(class_getName([self class]));
}

- (id)join
{
	if (_running == OF_THREAD_NOT_RUNNING || !of_thread_join(_thread))







|
>







365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380

	if (!of_thread_new(&_thread, callMain, self, &_attr)) {
		[self release];
		@throw [OFThreadStartFailedException exceptionWithThread: self];
	}

	if (_name != nil)
		of_thread_set_name(
		    [_name cStringWithEncoding: [OFLocalization encoding]]);
	else
		of_thread_set_name(class_getName([self class]));
}

- (id)join
{
	if (_running == OF_THREAD_NOT_RUNNING || !of_thread_join(_thread))