ObjFW  Check-in [bdfcb94f18]

Overview
Comment:Add +[thread] to OFThread and allow -[init].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bdfcb94f18b5d22673881b3b5d44fecc7620ddfcfe9c72a14e22e008699ceb98
User & Date: js on 2011-01-18 20:58:51
Other Links: manifest | tags
Context
2011-01-21
01:23
Remove variables $ENV_{CFLAGS,LIBS,LDFLAGS} in objfw-compile. check-in: ca9a6f1593 user: js tags: trunk
2011-01-18
20:58
Add +[thread] to OFThread and allow -[init]. check-in: bdfcb94f18 user: js tags: trunk
2011-01-17
18:54
Make OFBlocks compile with ObjFW-RT. check-in: d5aea9cf4c user: js tags: trunk
Changes

Modified configure.ac from [ce9d5beae9] to [aad91aaffc].

251
252
253
254
255
256
257
258

259
260
261
262
263
264
265
251
252
253
254
255
256
257

258
259
260
261
262
263
264
265







-
+








AC_ARG_ENABLE(threads,
	AS_HELP_STRING([--disable-threads], [disable thread support]))
AS_IF([test x"$enable_threads" != x"no"], [
	case "$host_os" in
	mingw*)
		AC_MSG_CHECKING(for threads)
		AC_MSG_RESULT(win32)
		AC_MSG_RESULT(WinAPI)
		;;
	*)
		ACX_PTHREAD([
			CPPLAGS="$CPPFLAGS $PTHREAD_CFLAGS"
			LIBS="$LIBS $PTHREAD_LIBS"
			AC_DEFINE(OF_HAVE_PTHREADS, 1,
				[Whether we have pthreads])

Modified src/OFThread.h from [2f02e73fed] to [365e7ac8cd].

74
75
76
77
78
79
80
81





82
83

84
85
86
87
88
89
90
74
75
76
77
78
79
80
81
82
83
84
85
86
87

88
89
90
91
92
93
94
95








+
+
+
+
+

-
+







		OF_THREAD_NOT_RUNNING,
		OF_THREAD_RUNNING,
		OF_THREAD_WAITING_FOR_JOIN
	} running;
	id retval;
}

/**
 * \return A new, autoreleased thread
 */
+ thread;

/**
 * \param obj An object that is passed to the main method as a copy or nil
 * \return A new autoreleased thread
 * \return A new, autoreleased thread
 */
+ threadWithObject: (id)obj;

/**
 * Sets the Thread Local Storage for the specified key.
 *
 * The specified object is first retained and then the object stored before is

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

64
65
66
67
68
69
70





71
72
73
74
75
76
77
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82







+
+
+
+
+







{
	if (self != [OFThread class])
		return;

	if (!of_tlskey_new(&thread_self))
		@throw [OFInitializationFailedException newWithClass: self];
}

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

+ threadWithObject: (id)obj
{
	return [[[self alloc] initWithObject: obj] autorelease];
}

+ (void)setObject: (id)obj
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
179
180
181
182
183
184
185








186
187
188
189
190
191
192







-
-
-
-
-
-
-
-







	[OFAutoreleasePool releaseAll];

	[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) {