NSThread sleep

1
2
3
4
5
6
7
8
9
10
11
12
13
14
int main(int argc, char *argv[])
{
    [NSThread detachNewThreadSelector:@selector(checkiTunesStatus) toTarget:self withObject:nil];
}
 
- (void) checkiTunesStatus
{	
	NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
	while (pTunesRun) {
		[NSThread sleepForTimeInterval:1.0];
	}
	[pool release];
	[NSThread release];
}

這個程式在一般的Application執行沒問題. 但是寫成 widget plugin就死翹翹了. 先自己記錄起來.之後再用這個 codes.