63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
- initWithObject: (id)obj
{
self = [super init];
object = [obj copy];
if (!of_thread_new(&thread, call_main, self)) {
Class c = isa;
[super dealloc];
@throw [OFInitializationFailedException newWithClass: c];
}
return self;
}
- main
{
return nil;
}
- join
{
of_thread_join(thread);
return retval;
}
- (void)dealloc
{
/*
* No need to handle errors - if canceling the thread fails, we can't
* do anything anyway. Most likely, it finished already or was already
* canceled.
*/
of_thread_cancel(thread);
[object release];
[super dealloc];
}
@end
@implementation OFTLSKey
|
>
>
>
>
>
|
|
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
- initWithObject: (id)obj
{
self = [super init];
object = [obj copy];
if (!of_thread_new(&thread, call_main, self)) {
Class c = isa;
[object release];
[super dealloc];
@throw [OFInitializationFailedException newWithClass: c];
}
running = YES;
return self;
}
- main
{
return nil;
}
- join
{
of_thread_join(thread);
running = NO;
return retval;
}
- (void)dealloc
{
/*
* No need to handle errors - if canceling the thread fails, we can't
* do anything anyway. Most likely, it finished already or was already
* canceled.
*/
if (running)
of_thread_cancel(thread);
[object release];
[super dealloc];
}
@end
@implementation OFTLSKey
|