25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
+
+
|
#import "thread.h"
#import "tlskey.h"
#include <dos/dostags.h>
#include <proto/dos.h>
#include <proto/exec.h>
#ifndef OF_MORPHOS
extern void of_tlskey_thread_exited(void);
#endif
static of_tlskey_t threadKey;
OF_CONSTRUCTOR()
{
OF_ENSURE(of_tlskey_new(&threadKey));
}
|
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
+
+
|
thread->function(thread->object);
ObtainSemaphore(&thread->semaphore);
@try {
thread->done = true;
#ifndef OF_MORPHOS
of_tlskey_thread_exited();
#endif
if (thread->detached)
detached = true;
else if (thread->joinTask != NULL)
Signal(thread->joinTask, (1ul << thread->joinSigBit));
} @finally {
ReleaseSemaphore(&thread->semaphore);
|