2 |
|
// NNThread.m -Not Nextstep Thread? |
3 |
|
// Nigel's Nice Thread? |
4 |
|
// |
5 |
< |
// Revision 1.2, Wednesday Nov 7 2001 |
5 |
> |
// Revision 1.4, Tuesday May 25 2004 |
6 |
|
// |
7 |
|
// Created by Nigel Pearson on Tue Nov 28 2000. |
8 |
|
// Public Domain. No rights reserved. |
9 |
|
// |
10 |
|
|
11 |
|
#import "NNThread.h" |
12 |
+ |
#import <objc/objc-runtime.h> // For objc_msgSend() prototype |
13 |
|
|
14 |
|
@implementation NNThread |
15 |
|
|
24 |
|
thread_suspend (machThread); // Suspend myself |
25 |
|
|
26 |
|
if ( allocPool ) |
27 |
< |
pool = [[NSAutoreleasePool alloc] init]; |
27 |
> |
pool = [NSAutoreleasePool new]; |
28 |
|
|
29 |
|
// [object sel] caused "cannot find method" warnings, so I do it a non-obvious way: |
30 |
|
objc_msgSend (object, sel); |
43 |
|
struct pthreadArgs *args = arg; |
44 |
|
|
45 |
|
if ( args -> allocPool ) |
46 |
< |
args -> pool = [[NSAutoreleasePool alloc] init]; |
46 |
> |
args -> pool = [NSAutoreleasePool new]; |
47 |
|
|
48 |
|
objc_msgSend (*(args->object), *(args->sel)); |
49 |
|
|
181 |
|
return self; |
182 |
|
} |
183 |
|
|
184 |
+ |
- (NNTimer *) initWithAutoRelPool |
185 |
+ |
{ |
186 |
+ |
self = [super init]; |
187 |
+ |
allocPool = YES; |
188 |
+ |
repeating = YES; |
189 |
+ |
return self; |
190 |
+ |
} |
191 |
+ |
|
192 |
+ |
|
193 |
|
- (void) changeIntervalTo: (int)number |
194 |
|
units: (NNTimeUnits)units |
195 |
|
{ |