apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arsen Chaloyan <achalo...@yahoo.com>
Subject Interruptable pollset
Date Mon, 02 Feb 2009 13:44:37 GMT
First of all thanks for the robust library, which serves just well and allows my project to
be cross-platform with very small footprint.

I had been looking for interruptable pollset and created small layer on top of apr_pollset_t
in my project based on stable apr-1.2 and apr-1.3 releases.
Meantime I've noticed the following
Changes for APR 1.4.0
  *) Introduce apr_pollset_wakeup() for interrupting the blocking apr_pollset_poll call.
     [Mladen Turk]

Exactly what I need and it just works as intened on Linux, but small note concerning Windows

Pollset is created with an internal pipe object used to interrupt poll if flags contain APR_POLLSET_WAKEABLE.
On Windows, where it's not possible to poll on files, apr_file_socket_pipe_create() function
is used to create a dummy pipe and I'm OK with this either. However the descriptor type should
be APR_POLL_SOCKET instead of APR_POLL_FILE in this case, otherwise apr_pollset_create() always
failes on Windows.

--- apr/poll/unix/select.c    (revision 739958)
+++ apr/poll/unix/select.c    (working copy)
@@ -207,7 +207,7 @@
                                           pollset->pool)) != APR_SUCCESS)
         return rv;
     fd.reqevents = APR_POLLIN;
-    fd.desc_type = APR_POLL_FILE;
+    fd.desc_type = APR_POLL_SOCKET;
     fd.desc.f = pollset->wakeup_pipe[0];


View raw message