44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
*/
return [[[self alloc] initWithObject: obj] autorelease];
}
+ setObject: (id)obj
forTLSKey: (OFTLSKey*)key
{
id old;
@try {
old = [self objectForTLSKey: key];
} @catch (OFNotInSetException *e) {
[e dealloc];
old = nil;
}
#ifndef _WIN32
if (pthread_setspecific(key->key, obj))
#else
if (!TlsSetValue(key->key, obj))
#endif
/* FIXME: Maybe another exception would be better */
@throw [OFNotInSetException newWithClass: self];
if (obj != nil)
[obj retain];
if (old != nil)
[old release];
return self;
|
<
<
<
|
<
<
<
<
|
>
|
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
*/
return [[[self alloc] initWithObject: obj] autorelease];
}
+ setObject: (id)obj
forTLSKey: (OFTLSKey*)key
{
id old = [self objectForTLSKey: key];
#ifndef _WIN32
if (pthread_setspecific(key->key, obj))
#else
if (!TlsSetValue(key->key, obj))
#endif
/* FIXME: Maybe another exception would be better */
@throw [OFInvalidArgumentException newWithClass: self
andSelector: _cmd];
if (obj != nil)
[obj retain];
if (old != nil)
[old release];
return self;
|
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#endif
/*
* NULL and nil might be different on some platforms. NULL is returned
* if the key is missing, nil can be returned if it was explicitly set
* to nil to release the old object.
*/
if (ret == NULL || (id)ret == nil)
@throw [OFNotInSetException newWithClass: self];
return (id)ret;
}
- initWithObject: (id)obj
{
Class c;
|
|
|
|
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
#endif
/*
* NULL and nil might be different on some platforms. NULL is returned
* if the key is missing, nil can be returned if it was explicitly set
* to nil to release the old object.
*/
if (ret == NULL)
return nil;
return (id)ret;
}
- initWithObject: (id)obj
{
Class c;
|