• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
stop a lengthy task in a thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: stop a lengthy task in a thread
      • From: Ondra Cada <email@hidden>
    • Re: stop a lengthy task in a thread
      • From: Dave Camp <email@hidden>
  • Prev by Date: Can't edit an NSTableView
  • Next by Date: RE: Text message
  • Previous by thread: Re: Can't edit an NSTableView
  • Next by thread: Re: stop a lengthy task in a thread
  • Index(es):
    • Date
    • Thread