cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: aborting curl_easy_perform()

From: Gary Wisniewski <haxx_se_at_gw.spidereye.com>
Date: Mon, 22 Aug 2005 21:26:21 +1000

Daniel Stenberg wrote:

>> This is, I believe, a fairly typical situation. I have a
>> multi-threaded program, and one of the threads is initiating or
>> executing a transfer. Other threads, oblivious to this, may be
>> operating a control panel or some other UI component which, at the
>> user's whim, may be clicked and cause the chosen transfer to
>> immediately terminate. I can't have the user "waiting" for this. It
>> needs to be instant.
>
>
> If you use your imagination you can figure out other ways to achieve
> the same thing and give the user a good impression.
>
> For example, you can start a new thread for the next transfer and
> allow the previous transfer thread to take its time to detect the
> "kill" situation and thus exit it "as soon as possible" without the
> user of the application noticing. That removes the need for
> "immediate" abort.

I actually implemented exactly that an hour or two ago, which achieved
the effect I've wanted. After taking a look at the curl
easy/multi/Win32 issues I realized that I was probably better off doing
it that way.

Since I already had the curl transport code in a separate thread, it was
fairly easy to detach that thread and let it run to completion while
starting a new one to handle the next request.

Thanks for your prompt reply.

-G
Received on 2005-08-22