ObjFW  Check-in [eb374bb382]

Overview
Comment:Rename tlsKey -> TLSKey. Acronyms are always uppercase!
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: eb374bb38232790dfca52715e2a6f3cf0fd9425833d8f135497710560a36465a
User & Date: js on 2011-01-11 22:45:30
Other Links: manifest | tags
Context
2011-01-13
14:24
Update .xcodeproj. check-in: f38b4705e3 user: js tags: trunk
2011-01-11
22:45
Rename tlsKey -> TLSKey. Acronyms are always uppercase! check-in: eb374bb382 user: js tags: trunk
22:43
Fix missing retain + autorelease in TLS-object handling. check-in: e9e263d62a user: js tags: trunk
Changes

Modified src/OFThread.h from [5c73dd92a3] to [2f02e73fed].

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
	of_list_object_t *listobj;
	BOOL initialized;
}

/**
 * \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;

+ (void)callAllDestructors;

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







|





|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
	of_list_object_t *listobj;
	BOOL initialized;
}

/**
 * \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;

+ (void)callAllDestructors;

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

Modified src/OFThread.m from [e6c064086f] to [87f3aa066d].

252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
@implementation OFTLSKey
+ (void)initialize
{
	if (self == [OFTLSKey class])
		tlskeys = [[OFList alloc] init];
}

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

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

+ (void)callAllDestructors
{
	of_list_object_t *iter;







|




|







252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
@implementation OFTLSKey
+ (void)initialize
{
	if (self == [OFTLSKey class])
		tlskeys = [[OFList alloc] init];
}

+ TLSKey
{
	return [[[self alloc] init] autorelease];
}

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

+ (void)callAllDestructors
{
	of_list_object_t *iter;

Modified tests/OFThreadTests.m from [cbb2d85d6a] to [827e358280].

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
	TEST(@"+[threadWithObject:]",
	    (t = [TestThread threadWithObject: @"foo"]))

	TEST(@"-[start]", R([t start]))

	TEST(@"-[join]", [[t join] isEqual: @"success"])

	TEST(@"OFTLSKey's +[tlsKey]", (key = [OFTLSKey tlsKey]))

	TEST(@"+[setObject:forTLSKey:]",
	    R([OFThread setObject: @"setme"
			forTLSKey: key]) &&
	    [[OFThread setObject: @"foo"
		       forTLSKey: key] isEqual: @"setme"])

	TEST(@"+[objectForTLSKey:]",
	    [[OFThread objectForTLSKey: key] isEqual: @"foo"])

	[pool drain];
}
@end







|




|
|







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
	TEST(@"+[threadWithObject:]",
	    (t = [TestThread threadWithObject: @"foo"]))

	TEST(@"-[start]", R([t start]))

	TEST(@"-[join]", [[t join] isEqual: @"success"])

	TEST(@"OFTLSKey's +[TLSKey]", (key = [OFTLSKey TLSKey]))

	TEST(@"+[setObject:forTLSKey:]",
	    R([OFThread setObject: @"setme"
			forTLSKey: key]) &&
	    R([OFThread setObject: @"foo"
			forTLSKey: key]))

	TEST(@"+[objectForTLSKey:]",
	    [[OFThread objectForTLSKey: key] isEqual: @"foo"])

	[pool drain];
}
@end