ObjFW  Check-in [fad0ff6539]

Overview
Comment:Add +[tlsKey] to OFTLSKey.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: fad0ff6539e3c157a7e83c870961c03ad87b96a77c679b1b72a6afea5fb462d6
User & Date: js on 2009-10-03 11:51:29
Other Links: manifest | tags
Context
2009-10-03
11:58
Migration of OFThread tests to new testing framework. check-in: 23aa1c1bf5 user: js tags: trunk
11:51
Add +[tlsKey] to OFTLSKey. check-in: fad0ff6539 user: js tags: trunk
2009-10-01
12:44
Migration of OFPlugin tests to new testing framework. check-in: 0ad8f57b16 user: js tags: trunk
Changes

Modified src/OFThread.h from [894be3846a] to [cae32ff3af].

18
19
20
21
22
23
24





25
26
27
28
29
30





31
32
33
34
35
36
37
 */
@interface OFTLSKey: OFObject
{
@public
	of_tlskey_t key;
}






/**
 * \param destructor A destructor that is called when the thread is terminated
 * \return A new autoreleased Thread Local Storage key
 */
+ tlsKeyWithDestructor: (void(*)(id))destructor;






/**
 * \param destructor A destructor that is called when the thread is terminated
 * \return An initialized Thread Local Storage key
 */
- initWithDestructor: (void(*)(id))destructor;
@end








>
>
>
>
>






>
>
>
>
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 */
@interface OFTLSKey: OFObject
{
@public
	of_tlskey_t key;
}

/**
 * \return A new autoreleased Thread Local Storage key
 */
+ tlsKey;

/**
 * \param destructor A destructor that is called when the thread is terminated
 * \return A new autoreleased Thread Local Storage key
 */
+ tlsKeyWithDestructor: (void(*)(id))destructor;

/**
 * \return An initialized Thread Local Storage key
 */
- init;

/**
 * \param destructor A destructor that is called when the thread is terminated
 * \return An initialized Thread Local Storage key
 */
- initWithDestructor: (void(*)(id))destructor;
@end

Modified src/OFThread.m from [72efe40c4e] to [3dbf79b6f7].

97
98
99
100
101
102
103





104
105
106
107













108
109
110
111
112
113
114

	[object release];
	[super dealloc];
}
@end

@implementation OFTLSKey





+ tlsKeyWithDestructor: (void(*)(id))destructor
{
	return [[[self alloc] initWithDestructor: destructor] autorelease];
}














- initWithDestructor: (void(*)(id))destructor
{
	self = [super init];

	/* FIXME: Call destructor on Win32 */
	if (!of_tlskey_new(&key, destructor)) {







>
>
>
>
>




>
>
>
>
>
>
>
>
>
>
>
>
>







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132

	[object release];
	[super dealloc];
}
@end

@implementation OFTLSKey
+ tlsKey
{
	return [[[self alloc] init] autorelease];
}

+ tlsKeyWithDestructor: (void(*)(id))destructor
{
	return [[[self alloc] initWithDestructor: destructor] autorelease];
}

- init
{
	self = [super init];

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

	return self;
}

- initWithDestructor: (void(*)(id))destructor
{
	self = [super init];

	/* FIXME: Call destructor on Win32 */
	if (!of_tlskey_new(&key, destructor)) {