ObjFW  Diff

Differences From Artifact [4035170a3e]:

To Artifact [6d911d6e5b]:


131
132
133
134
135
136
137


138
139
140
141
142
143
144
145

146




147
148
149
150
151
152
153
	[thread release];

	of_thread_exit();
}

- init
{


	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

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


	object = [obj retain];





	return self;
}

- (id)main
{
	@throw [OFNotImplementedException newWithClass: isa







>
>
|







>
|
>
>
>
>







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
	[thread release];

	of_thread_exit();
}

- init
{
	Class c = isa;
	[self release];
	@throw [OFNotImplementedException newWithClass: c
					      selector: _cmd];
}

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

	@try {
		object = [obj retain];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (id)main
{
	@throw [OFNotImplementedException newWithClass: isa
225
226
227
228
229
230
231

232
233
234
235

236
237
238
239
240
241
242

243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
	}
}

- init
{
	self = [super init];


	if (!of_tlskey_new(&key)) {
		Class c = isa;
		[super dealloc];
		@throw [OFInitializationFailedException newWithClass: c];

	}

	destructor = NULL;

	@synchronized (tlskeys) {
		@try {
			listobj = [tlskeys appendObject: self];

		} @catch (OFException *e) {
			/*
			 * We can't use [super dealloc] on OS X here.
			 * Compiler bug? Anyway, [self dealloc] will do here
			 * as we check listobj != NULL in dealloc.
			 */
			listobj = NULL;
			[self dealloc];
			@throw e;
		}
	}

	return self;
}

- initWithDestructor: (void(*)(id))destructor_
{







>
|
<
<
|
>
|
<
|

|
<

>
|
<
<
<
<
<
<
|
|
<







232
233
234
235
236
237
238
239
240


241
242
243

244
245
246

247
248
249






250
251

252
253
254
255
256
257
258
	}
}

- init
{
	self = [super init];

	@try {
		if (!of_tlskey_new(&key))


			@throw [OFInitializationFailedException
			    newWithClass: isa];


		destructor = NULL;

		@synchronized (tlskeys) {

			listobj = [tlskeys appendObject: self];
		}
	} @catch (id e) {






		[self release];
		@throw e;

	}

	return self;
}

- initWithDestructor: (void(*)(id))destructor_
{
267
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
298
299
300
301
302
303
- (void)dealloc
{
	if (destructor != NULL)
		destructor(self);

	of_tlskey_free(key);

	@synchronized (tlskeys) {
		/* In case we called [self dealloc] in init */
		if (listobj != NULL)

			[tlskeys removeListObject: listobj];

	}

	[super dealloc];
}
@end

@implementation OFMutex
+ mutex
{
	return [[[self alloc] init] autorelease];
}

- init
{
	self = [super init];

	if (!of_mutex_new(&mutex)) {
		Class c = isa;
		[self dealloc];
		@throw [OFInitializationFailedException newWithClass: c];
	}

	return self;
}

- (void)lock







<
|
|
>

>


















|







266
267
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
298
299
300
301
302
303
- (void)dealloc
{
	if (destructor != NULL)
		destructor(self);

	of_tlskey_free(key);


	/* In case we called [self release] in init */
	if (listobj != NULL) {
		@synchronized (tlskeys) {
			[tlskeys removeListObject: listobj];
		}
	}

	[super dealloc];
}
@end

@implementation OFMutex
+ mutex
{
	return [[[self alloc] init] autorelease];
}

- init
{
	self = [super init];

	if (!of_mutex_new(&mutex)) {
		Class c = isa;
		[self release];
		@throw [OFInitializationFailedException newWithClass: c];
	}

	return self;
}

- (void)lock