On 17/11/2021 08:08, Ruediger Pluem wrote:


On 11/17/21 2:39 AM, Mladen Turk wrote:


On 16/11/2021 12:00, Yann Ylavic wrote:
On Wed, Nov 10, 2021 at 4:19 PM Yann Ylavic <ylavic....@gmail.com> wrote:

Otherwise I'll revert because I have no way to test it, but I think
that apr_poll_drain_wakeup_pipe() might block on Windows for the same
reason as r1894914 for platforms with poll()able pipes.

Reverted in 1.7.x, I'll leave it in trunk for now..



pollset should have something like 'send_wakeup' member
that will be reset by apr_poll_drain_wakeup_pipe call.

The problem is how to make thread safe.

How about using an int flag set / read with atomic operations e.g. 
apr_atomic_cas32?
Atomic stuff should not add too much performance penalties.


Yep, that was my thought as well.
Adding 'volatile apr_uint32_t wakeup_set' to pollcb and pollset structures.

pollset/pollcb wakeup would call the
apr_file_putc only if (apr_atomic_cas32(&p->wakeup_set, 1, 0) == 0)
Accordingly apr_poll_drain_wakeup_pipe would call apr_file_getc
while (apr_atomic_cas32(&p->wakeup_set, 0, 1) > 0)

It would actually speed things up since atomic compare
is much faster then filling up the drain pipe.



Regards
--
^TM

Reply via email to