NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/41019: pthreads: high load when using varnish (locking/unlocking causes 98% WCPU)
The following reply was made to PR lib/41019; it has been noted by GNATS.
From: Michael Stapelberg <michael+netbsd%stapelberg.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: Christos Zoulas <christos%zoulas.com@localhost>
Subject: Re: lib/41019: pthreads: high load when using varnish
(locking/unlocking causes 98% WCPU)
Date: Sun, 22 Mar 2009 15:50:59 +0100
Hi Christos,
* [22.03.09 15:38]:
> It is not a NetBSD issue:
> http://opengroup.org/onlinepubs/007908799/xsh/usleep.html
Yes, I know, and I didnâ??t claim. I just wanted to emphasize that other
systems
do handle bigger values though itâ??s not correct.
> And in your fix you are not using nanosleep because you claim it has
> similar issues. I think it does not, so in reality the code should be
Did you actually try it? Because if you loock at the usleep-implementation, it
calls nanosleep with useconds * 1000, thatâ??d be 1000 * 1000 * 1000 in our
example. Now, look at nanosleep(2) and youâ??ll see EINVAL for values greater
than 1000 millionâ?¦
> #define U2S 1000000
> if (usec >= U2S) {
> unsigned int sec = usec / U2S;
> usec %= U2S;
>
> sleep(sec);
> usleep(usec);
> }
Thank you, that looks like a good solution. Iâ??ve submitted it to the varnish
bugtracker.
Best regards,
Michael
Home |
Main Index |
Thread Index |
Old Index