ObjFW  Check-in [e8f12e5de9]

Overview
Comment:OFThread: Set status before spawning thread.

This way, it's not possible to set the status after the thread has
already set it, though this should only happen if the thread instantly
terminates.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e8f12e5de9b91d6ba9a51aff5e724a5d5f170f0c104ffaeca3bd7e03d3da0661
User & Date: js on 2012-08-11 08:39:32
Other Links: manifest | tags
Context
2012-08-11
11:55
runtime.h: Fix C++. check-in: c2a3a3e078 user: js tags: trunk
08:39
OFThread: Set status before spawning thread. check-in: e8f12e5de9 user: js tags: trunk
2012-08-10
20:08
Add GNU stack note. check-in: 7e27f00a5d user: js tags: trunk
Changes

Modified src/OFThread.m from [03f9920eb4] to [b522bb5862].

269
270
271
272
273
274
275


276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291

	if (running == OF_THREAD_WAITING_FOR_JOIN) {
		of_thread_detach(thread);
		[returnValue release];
	}

	[self retain];



	if (!of_thread_new(&thread, call_main, self)) {
		[self release];
		@throw [OFThreadStartFailedException
		    exceptionWithClass: [self class]
				thread: self];
	}

	running = OF_THREAD_RUNNING;
}

- (id)join
{
	if (running == OF_THREAD_NOT_RUNNING || !of_thread_join(thread))
		@throw [OFThreadJoinFailedException
		    exceptionWithClass: [self class]







>
>







<
<







269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284


285
286
287
288
289
290
291

	if (running == OF_THREAD_WAITING_FOR_JOIN) {
		of_thread_detach(thread);
		[returnValue release];
	}

	[self retain];

	running = OF_THREAD_RUNNING;

	if (!of_thread_new(&thread, call_main, self)) {
		[self release];
		@throw [OFThreadStartFailedException
		    exceptionWithClass: [self class]
				thread: self];
	}


}

- (id)join
{
	if (running == OF_THREAD_NOT_RUNNING || !of_thread_join(thread))
		@throw [OFThreadJoinFailedException
		    exceptionWithClass: [self class]