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.
Index: D:/Repository/svn/apr/poll/unix/select.c
===================================================================
--- D:/Repository/svn/apr/poll/unix/select.c (revision 743308)
+++ D:/Repository/svn/apr/poll/unix/select.c (working copy)
@@ -259,11 +259,24 @@
}
}
+#if !APR_FILES_AS_SOCKETS
+static apr_status_t socket_pipe_cleanup(apr_file_t *file)
+{
+ if (file->filehand != INVALID_HANDLE_VALUE) {
+ shutdown((SOCKET)file->filehand, SD_BOTH);
+ closesocket((SOCKET)file->filehand);
+ file->filehand = INVALID_HANDLE_VALUE;
+ }
+ return APR_SUCCESS;
+}
+#endif
+
static apr_status_t wakeup_pipe_cleanup(void *p)
{
apr_pollset_t *pollset = (apr_pollset_t *) p;
if (pollset->flags & APR_POLLSET_WAKEABLE) {
- /* Close both sides of the wakeup pipe */
+#if APR_FILES_AS_SOCKETS
+ /* Close both sides of the wakeup pipe */
if (pollset->wakeup_pipe[0]) {
apr_file_close(pollset->wakeup_pipe[0]);
pollset->wakeup_pipe[0] = NULL;
@@ -272,6 +285,17 @@
apr_file_close(pollset->wakeup_pipe[1]);
pollset->wakeup_pipe[1] = NULL;
}
+#else
+ /* Close both sides of the wakeup pipe */
+ if (pollset->wakeup_pipe[0]) {
+ socket_pipe_cleanup(pollset->wakeup_pipe[0]);
+ pollset->wakeup_pipe[0] = NULL;
+ }
+ if (pollset->wakeup_pipe[1]) {
+ socket_pipe_cleanup(pollset->wakeup_pipe[1]);
+ pollset->wakeup_pipe[1] = NULL;
+ }
+#endif
}
return APR_SUCCESS;
Probably it makes sense to provide public functions to create and destroy
file_socket_pipe encapsulated in pipe.c.
Regards,
Arsen.
________________________________
From: Mladen Turk <[email protected]>
To: Arsen Chaloyan <[email protected]>
Cc: [email protected]
Sent: Tuesday, February 10, 2009 1:59:10 PM
Subject: Re: Interruptable pollset
Arsen Chaloyan wrote:
> Hi,
> Is there anybody who can address the reported issue? I assume it's a trivial
> one, unless I'm missing something very obvious.
Wasn't that trivial, but not that hard as well,
see r742921
I'll propose the backport to 1.4 branch as well
Regards
-- ^(TM)