30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
return 0;
}
#endif
@implementation OFThread
+ threadWithObject: (id)obj
{
/*
* This is one of the rare cases where the convenience method should
* use self instead of the class.
*
* The reason is that you derive from OFThread and reimplement main.
* If OFThread instead of self would be used here, the reimplemented
* main would never be called.
*/
return [[[self alloc] initWithObject: obj] autorelease];
}
+ setObject: (id)obj
forTLSKey: (OFTLSKey*)key
{
id old = [self objectForTLSKey: key];
|
<
<
<
<
<
<
<
<
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
return 0;
}
#endif
@implementation OFThread
+ threadWithObject: (id)obj
{
return [[[self alloc] initWithObject: obj] autorelease];
}
+ setObject: (id)obj
forTLSKey: (OFTLSKey*)key
{
id old = [self objectForTLSKey: key];
|
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
[super dealloc];
}
@end
@implementation OFTLSKey
+ tlsKeyWithDestructor: (void(*)(void*))destructor
{
return [[[OFTLSKey alloc] initWithDestructor: destructor] autorelease];
}
- initWithDestructor: (void(*)(void*))destructor
{
Class c;
self = [super init];
|
|
|
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
[super dealloc];
}
@end
@implementation OFTLSKey
+ tlsKeyWithDestructor: (void(*)(void*))destructor
{
return [[[self alloc] initWithDestructor: destructor] autorelease];
}
- initWithDestructor: (void(*)(void*))destructor
{
Class c;
self = [super init];
|