Re: Exiting NSThread
Re: Exiting NSThread
- Subject: Re: Exiting NSThread
- From: Dustin Mierau <email@hidden>
- Date: Sat, 29 Sep 2001 14:52:05 -0700
What I meant was I have a thread which connects using bsd
sockets to say an ftp server, now i am in the middle of
downloading a file in a while loop, now the app quits, how do i
exit that thread cleanly? I want to obviously close the
connection to the server and exit the thread.
Thanks,
-dustin
Dustin,
Dustin Mierau (DM) wrote at Sat, 29 Sep 2001 13:27:16 -0700:
DM> connect_to_host(IP,port);
DM>
DM> while(1)
DM> {
DM> read_data_for_a_long_long_long_time();
DM> }
DM>
DM> disconnect();
DM>
DM> If the thread is just cleaned up for me, how do I ever disconnect?
Connections are cleaned as well.
If you happen to use some resource which is *not* cleaned up
(like, say, an
external file), you should clean it up in appWillTerminate: (or some
appropriate notification observer).
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev