ObjFW  Diff

Differences From Artifact [ee16dd390b]:

To Artifact [15c3b7304d]:


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
23
24
25
26
27
28
29




30
31
32
33
34
35
36







-
-
-
-







#ifndef _WIN32
# include <unistd.h>
# include <sched.h>
#else
# include <windows.h>
#endif

#if defined(OF_GNU_RUNTIME) || defined(OF_OLD_GNU_RUNTIME)
# import <objc/thr.h>
#endif

#import "OFThread.h"
#import "OFList.h"
#import "OFDate.h"
#import "OFAutoreleasePool.h"

#import "OFConditionBroadcastFailedException.h"
#import "OFConditionSignalFailedException.h"
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
53
54
55
56
57
58
59




60
61
62
63
64
65
66







-
-
-
-







static of_tlskey_t threadSelf;

static id
call_main(id object)
{
	OFThread *thread = (OFThread*)object;

#if defined(OF_GNU_RUNTIME) || defined(OF_OLD_GNU_RUNTIME)
	objc_thread_add();
#endif

	if (!of_tlskey_set(threadSelf, thread))
		@throw [OFInitializationFailedException
		    exceptionWithClass: [thread class]];

	/*
	 * Nasty workaround for thread implementations which can't return a
	 * value on join.
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
79
80
81
82
83
84
85




86
87
88
89
90
91
92







-
-
-
-







	thread->running = OF_THREAD_WAITING_FOR_JOIN;

	[OFTLSKey callAllDestructors];
	[OFAutoreleasePool _releaseAll];

	[thread release];

#if defined(OF_GNU_RUNTIME) || defined(OF_OLD_GNU_RUNTIME)
	objc_thread_remove();
#endif

	return 0;
}

@implementation OFThread
#if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS)
@synthesize block;
#endif
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
211
212
213
214
215
216
217




218
219
220
221
222
223
224







-
-
-
-







	}

	[OFTLSKey callAllDestructors];
	[OFAutoreleasePool _releaseAll];

	[thread release];

#if defined(OF_GNU_RUNTIME) || defined(OF_OLD_GNU_RUNTIME)
	objc_thread_remove();
#endif

	of_thread_exit();
}

- initWithObject: (id)object_
{
	self = [super init];