stop a lengthy task in a thread
stop a lengthy task in a thread
- Subject: stop a lengthy task in a thread
- From: Morphine <email@hidden>
- Date: Tue, 18 May 2004 23:32:42 +0200
Hello,
I don't found how to stop a lengthy task in a thread !!!
Here, what I have do :
IN THE THREAD :
- (void oneway) calcul { // this method is called by the main
application
NSDirectoryEnumerator *enumDirectories = [fileManager
enumeratorAtPath:@"/"] ;
while (file = [enumDirectories nextObject]) {
if (stop) break ; // stop is declared in header file as BOOL
// a task...
}
}
- (void oneway) pleaseStop { // this method is called by the main
application
NSLock *lock = [[NSLock alloc] init] ;
[lock lock] ;
stop = YES ;
[lock unlock] ;
}
How to do for set the "stop" bool to change it's state ???
PS : I don't want to exit the thread, simply to break the "while()"
Thank you very much.
______________________________________
David Miglior
WyWiWyg - What You Want Is What You Get
5, rue Castel
06000 Nice
Til. +33 (0)4.97.14.09.49
Mobile : +33 (0)6 22 25 76 97
mailto:email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.