• 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
Re: Stopping an NSThread (or something similar)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stopping an NSThread (or something similar)


  • Subject: Re: Stopping an NSThread (or something similar)
  • From: Nir Soffer <email@hidden>
  • Date: Fri, 14 Jul 2006 05:23:21 +0300


On 14/07/2006, at 04:35, Michael Becker wrote:

Sorry for the forwarding, I used the wrong e-mail account to send this e-mail before...

Anfang der weitergeleiteten E-Mail:
Hi,

my application is designed to upload files via an HTTP POST request. I am using libcurl to do this, as libcurl allows me to monitor the upload progress (which NSURLConnection obviously does not). However, I am having a problem: Naturally, I want the user to be able to click a button to immediately stop the upload. I am uploading the files in a secondary thread. If I use the good ol' technique that's using a BOOL variable to tell the secondary thread to stop, this won't work properly as the thread will only be able to check the variable between file uploads. So if the user triggers a 10 MB upload and wants to stop that, they will have to wait until the 10 MBs are uploaded before the thread stops.

The thing is, that I cannot interfere with the uploading (I guess). I simply call "curl_easy_perform()" and off it goes. The problem I've posted here to me seems to be one of the more fundamental "things-everybody-needs". E.g., Safari allows you to stop the download of files, too. So does more or less any networking application I can think of right now.

How are they doing that?

Regards,
Michael

PS: Remember: I am talking about UPloading files. DOWNloading actually seems to be supported very well and boasting any feature you'd ever wish for...

I think you can stop the upload by returning 0 from your read callback.


Best Regards,

Nir Soffer

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Stopping an NSThread (or something similar) (From: Michael Becker <email@hidden>)

  • Prev by Date: Re: Array of random, non-repeating numbers
  • Next by Date: Re: Stopping an NSThread (or something similar)
  • Previous by thread: Stopping an NSThread (or something similar)
  • Next by thread: Re: Stopping an NSThread (or something similar)
  • Index(es):
    • Date
    • Thread