httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Ylavic <ylavic....@gmail.com>
Subject Re: Question about atomic in "mpm/worker/fdqueue.c"
Date Sat, 20 Aug 2016 16:07:53 GMT
On Sat, Aug 20, 2016 at 9:34 AM, Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
> Hi,
>
> shouldn't "queue_info->idlers" on line 138 of "mpm/worker/fdqueue.c" be read
> using "apr_atomic_read32" ?

Actually both apr_atomic_read32() and current volatile declaration are
racy here, 'idlers' may become 0 between the check and
apr_atomic_dec32(), and we don't expect negative idlers in
worker/fdqueue.c...

The right thing to do would be "if (apr_atomic_dec32() == 0)" (or
rather "apr_atomic_add32(&idlers, -1) <= zero_pt" like in
event/fdqueue.c).

Time to put a single fdqueue implementation in fdqueue_common?

Regards,
Yann.

Mime
View raw message