curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_multi_perform sometimes does not return while its threadus es1 00% cpu resources

From: Stephan Mühlstrasser via curl-library <curl-library_at_cool.haxx.se>
Date: Thu, 13 Dec 2018 09:52:06 +0100

Am 13.12.18 um 08:46 schrieb "h9791521_at_docomo.ne.jp" via curl-library:

> Lib\spray.c
>  if(compare(i, t->key) < 0) {  <====== never become negative
>    /* even the smallest is too big */
>    *removed = NULL;
>    return t;
>  }
>
> https://github.com/curl/curl/issues/2004
> The loop happens on systems where time_t is defined to an unsigned type
> (e.g. QNX).
> Differences between unsigned types will never become negative.

I assume that you are referring to lib/splay.c. compare() is a macro
which resolves to another macro Curl_splaycomparekeys() from lib/splay.h:

#define Curl_splaycomparekeys(i,j) ( ((i.tv_sec) < (j.tv_sec)) ? -1 : \
                                    ( ((i.tv_sec) > (j.tv_sec)) ? 1 : \
                                    ( ((i.tv_usec) < (j.tv_usec)) ? -1 : \
                                    ( ((i.tv_usec) > (j.tv_usec)) ? 1 :
0))))

So compare() can indeed return a value less than zero.

-- 
Stephan
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2018-12-13