Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- put this in the contructor of the class that will be the background thread:
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- [NSThread detachNewThreadSelector:@selector(threadMethod:) toTarget:self withObject:nil];
- [pool release];
- then in threadMethod
- - (void)threadMethod:(id)param
- {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- while (YES) {
- [NSThread sleepForTimeInterval:(float)SLEEP_TIME];
- //dostuff
- }
- [pool release];
- }
Add Comment
Please, Sign In to add comment