ObjFW  Diff

Differences From Artifact [67db96fe50]:

To Artifact [0906d8e684]:


131
132
133
134
135
136
137
138

139

140
141
142
143



144
145


146
147
148
149
150
151
152
131
132
133
134
135
136
137

138
139
140
141



142
143
144
145

146
147
148
149
150
151
152
153
154







-
+

+

-
-
-
+
+
+

-
+
+







		of_thread_set_name(
		    [name cStringWithEncoding: [OFLocale encoding]]);
	else
		of_thread_set_name(object_getClassName(thread));

	/*
	 * Nasty workaround for thread implementations which can't return a
	 * pointer on join.
	 * pointer on join, or don't have a way to exit a thread.
	 */
	if (setjmp(thread->_exitEnv) == 0) {
# ifdef OF_HAVE_BLOCKS
	if (thread->_threadBlock != NULL)
		thread->_returnValue = [thread->_threadBlock() retain];
	else
		if (thread->_threadBlock != NULL)
			thread->_returnValue = [thread->_threadBlock() retain];
		else
# endif
		thread->_returnValue = [[thread main] retain];
			thread->_returnValue = [[thread main] retain];
	}

	[thread handleTermination];

	thread->_running = OF_THREAD_WAITING_FOR_JOIN;

	objc_autoreleasePoolPop(thread->_pool);
	[OFAutoreleasePool of_handleThreadTermination];
323
324
325
326
327
328
329
330

331
332
333
334

335
336
337
338

339
340
341
342
343
344
345
346
347
348
349
350
325
326
327
328
329
330
331

332

333


334




335





336
337
338
339
340
341
342







-
+
-

-
-
+
-
-
-
-
+
-
-
-
-
-







	OF_UNREACHABLE
}

+ (void)terminateWithObject: (id)object
{
	OFThread *thread = of_tlskey_get(threadSelfKey);

	if (thread != nil) {
	OF_ENSURE(thread != nil);
		thread->_returnValue = [object retain];

		[thread handleTermination];

	thread->_returnValue = [object retain];
		thread->_running = OF_THREAD_WAITING_FOR_JOIN;
		objc_autoreleasePoolPop(thread->_pool);
	}

	longjmp(thread->_exitEnv, 1);
	[OFAutoreleasePool of_handleThreadTermination];

	[thread release];

	of_thread_exit();
}

+ (void)setName: (OFString *)name
{
	[OFThread currentThread].name = name;

	if (name != nil)