bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH]: update tls and lock tests, gl_cond_t WIN32 implementation


From: Yoann Vandoorselaere
Subject: Re: [PATCH]: update tls and lock tests, gl_cond_t WIN32 implementation
Date: Sun, 12 Oct 2008 14:10:52 +0200

Hi Bruno,

Le dimanche 12 octobre 2008 à 00:16 +0200, Bruno Haible a écrit :
> You wrote on 2008-09-18 
> <http://lists.gnu.org/archive/html/bug-gnulib/2008-09/msg00194.html>
> and 2008-10-02 
> <http://lists.gnu.org/archive/html/bug-gnulib/2008-10/msg00027.html>:
> 
> > provide a working implementation of gl_cond_t for WIN32 platform
> > (based on http://www.cs.wustl.edu/~schmidt/win32-cv-1.html).
> 
> Thanks a lot for this. Took me a long time, but I'm now committing a modified
> version of your implementation. At first, I had overlooked your mail and tried
> to produce an implementation by myself. But it did not pass the test_timedcond
> test. Gladly I then took your implementation, because it passed all tests :-)
> 
> Nevertheless, I had to make many changes:
>   - glthread_cond_timedwait_func had a completely wrong handling of the
>     timeout. The conversion from absolute time to milliseconds was only done
>     once, at the beginning. But because some locks need to be taken - which
>     can introduce delays - and because WaitForSingleObject is invoked in a 
> loop,
>     the conversion from absolute time to milliseconds must be done just
>     before WaitForSingleObject, once in each loop iteration. Additionally,
>     during this conversion an integer overflow could occur in at least 2 
> places
>     (1. result->tv_sec = x->tv_sec - y->tv_sec
>      2. (res.tv_sec * 1000) + (res.tv_usec / 1000)).

You might want to push your #1 changes up to the GLIBC team: the
timeval_subtract function is provided from the LIBC documentation:

http://www.gnu.org/software/libtool/manual/libc/Elapsed-Time.html

Regards,

-- 
Yoann Vandoorselaere | Responsable R&D / CTO | PreludeIDS Technologies
Tel: +33 (0)9 50 70 21 58                  Fax: +33(0)9 57 25 21 58
http://www.prelude-ids.com





reply via email to

[Prev in Thread] Current Thread [Next in Thread]