Well, below is final at this time not so trivial issue still concerning Windows implementation only.
Interruptable pollset creation sporadically fails.
How to reproduce:
Call apr_pollset_create() in a loop, say 100 times, you will see that some of the attempts fail.
How to fix:
See static apr_status_t create_socket_pipe(SOCKET *rd, SOCKET *wr) in file_io/win32/pipe.c
The following assumption is not always true
/* Listening socket is nonblocking by now.
* The accept must create the socket
* immediatelly because we connected
I would say: The accept should create the socket, but still may fail.
As far as listening socket is nonblocking, reasonable number of attempts of accept() call should be considered. Alternatively listening socket can be switched to blocking mode before accept() call.
I still use 1.2 and 1.3 versions, and have interruptable pollset functionality implemented on top of apr_pollset.
It works just fine on my side, just wanted to contribute back to the APR project.
From: Mladen Turk <email@example.com>
Sent: Thursday, February 12, 2009 9:10:54 PM
Subject: Re: Interruptable pollset
Arsen Chaloyan wrote:
> Well and thanks, Mladen.
> Below is the next issue you should want to fix: apr_pollset_destroy() crashes if pollset was created with enabled APR_POLLSET_WAKEABLE.
> The reason is wakeup_pipe_cleanup() should consider !APR_FILES_AS_SOCKETS case. This is still easy to fix and please find the patch below.
I added the apr_file_socket_pipe_close internal function.
It's inside 1.4.x branch together with previous patch.
For trunk I plan to use the same code but it'll go
together with the new pollset provider api.