cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Busy looping bug in multi_socket interface

From: Christopher Palow <cpalow_at_facebook.com>
Date: Tue, 29 Apr 2008 18:51:58 -0700

Itıs a fair point once system calls become sub microsecond weıd start busy
looping again.

Why not just a struct timeval for the key? Itıs basically two longs.

Chris

On 4/29/08 6:35 PM, "Yang Tse" <yangsita_at_gmail.com> wrote:

> 2008/4/30, Jamie Lokier wrote:
>
>> > [...] changing to microseconds reduces the
>> > busy loop time to one microsecond, which doesn't fix the logic flaw,
>> > but at least hides it on all real computers.
>
> Good point there !
>
> Here goes an idea for the key data type...
>
> Using a compound key of two 'long' data types would be portable safe.
> The first part of the key would be the timeval 'seconds' part and the
> second one the 'microseconds' one.
>
> The 'compare' macro would be little bit more involved since it would
> have four arguments.
>
> #define compare(Kis,Kiu,Kjs,Kju) (((Kis)==(Kjs))?(Kiu)-(Kju):(Kis)-(Kjs))
>
> And functions would simply change to something similar like:
>
> struct Curl_tree *Curl_splay(long ks, long ku, struct Curl_tree *t);
> struct Curl_tree *Curl_splayinsert(long ks, long ku, struct Curl_tree
> *t, struct Curl_tree *node);
> struct Curl_tree *Curl_splaygetbest(long ks, long ku, struct Curl_tree
> *t, struct Curl_tree **removed);
>
> Clear enough to grab the idea ?
>
> --
> -=[Yang]=-
>
Received on 2008-04-30