curl-users
Re: stop-command / C++ wrapper
Date: Fri, 15 Sep 2000 16:29:16 +0200 (MET DST)
On Fri, 15 Sep 2000, Thomas Ko wrote:
(CC'ed to the libcurl list as well)
> that's not an option because I want to use the class in an threaded
> environment. - and killing threads - i don't know if it works good
> enough.
I know it isn't a nice option, and no, killing threads is generally not a
good thing since it wouldn't free the memory properly.
> > If you would design the perfect stop-command, how would it work?
>
> I haven't looked at the code for curl_easy_perform() (i don't know the
> exact name yet) but it should have a flag-test in the worker-loop that has to
> be tested - when it is set, the loop will finish - not very different to the
> callback-method but a little bit more user-friendly. IMHO
_Transfer() is the name of the function in lib/highlevel.c that has the
"worker-loop".
I could of course add a check for a bit somewhere and allow a
curl_easy_stop() function. However, in a case where the network is idle, it
could take quite a while before it would actually notice that flag.
To make it good enough, I figure I should set a bit and write some nonsense
to the file descriptor that the select() in _Transfer() is hanging on. And
then, if the bit is set it just don't read anymore and then never notices the
nonsense byte...
Anyone care to comment?
> Any suggestions for a the interface of the class?
Not really. I haven't really thought things over what I'd like to see and use
if I had a C++ified curl...
It would be good if someone else had some input on this.
-- Daniel Stenberg - http://daniel.haxx.se - +46-705-44 31 77 ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`olReceived on 2000-09-15