Threads interruption
Threads interruption
- Subject: Threads interruption
- From: Raff <email@hidden>
- Date: Tue, 20 Aug 2002 14:28:10 +0200
Hi,
I'm trying to make my threads stop when the user clicks the 'stop'
button.
The only solution I found to avoid memory leaks (by calling -exit) is to
make my threads watch a volatile BOOL 'end' variable to exit the
infinite loop when it it TRUE.
But as my thread (from a pool of threads) is downloading files from the
Internet, for example images using :
data = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]] and then
result = [data writeToFile:file atomically:YES]
so that the thread is stopping after the downloading operation has
finished.
It can take twenty seconds to stop (for a 4-threads pool) !
I would like to know if it is possible to stop those operations, or if
I'm in a wrong way.
Thanks
R.D.
_______________________________________________
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.