ObjFW  Diff

Differences From Artifact [b9ff0cb8da]:

To Artifact [e9af0aca95]:

  • File src/OFThread.m — part of check-in [52e02c06ca] at 2014-08-01 12:27:29 on branch trunk — Change return type for thread main

    This changes the return type to void, as the return type of a thread's
    main depends on the threading implementation used. For pthreads, it adds
    a wrapper function which returns NULL to avoid problems with bogus
    return values. For WinAPI threads, the function is just casted, as bogus
    return values don't seem to matter there. (user: js, size: 8593) [annotate] [blame] [check-ins using]


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

#ifdef OF_HAVE_THREADS
# import "threading.h"

static of_tlskey_t threadSelfKey;
static OFThread *mainThread;

static id
callMain(id object)
{
	OFThread *thread = (OFThread*)object;

	if (!of_tlskey_set(threadSelfKey, thread))
		@throw [OFInitializationFailedException
		    exceptionWithClass: [thread class]];







|







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

#ifdef OF_HAVE_THREADS
# import "threading.h"

static of_tlskey_t threadSelfKey;
static OFThread *mainThread;

static void
callMain(id object)
{
	OFThread *thread = (OFThread*)object;

	if (!of_tlskey_set(threadSelfKey, thread))
		@throw [OFInitializationFailedException
		    exceptionWithClass: [thread class]];
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121

	thread->_running = OF_THREAD_WAITING_FOR_JOIN;

	objc_autoreleasePoolPop(thread->_pool);
	[OFAutoreleasePool OF_handleThreadTermination];

	[thread release];

	return 0;
}
#endif

@implementation OFThread
#ifdef OF_HAVE_THREADS
# if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS)
@synthesize threadBlock = _threadBlock;







<
<







106
107
108
109
110
111
112


113
114
115
116
117
118
119

	thread->_running = OF_THREAD_WAITING_FOR_JOIN;

	objc_autoreleasePoolPop(thread->_pool);
	[OFAutoreleasePool OF_handleThreadTermination];

	[thread release];


}
#endif

@implementation OFThread
#ifdef OF_HAVE_THREADS
# if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS)
@synthesize threadBlock = _threadBlock;