On 04/19/2008 06:26 PM, [EMAIL PROTECTED] wrote:
Author: mturk
Date: Sat Apr 19 09:26:39 2008
New Revision: 649830
URL: http://svn.apache.org/viewvc?rev=649830&view=rev
Log:
Introduce (again) apr_pollset_wakeup API
Modified:
apr/apr/trunk/CHANGES
apr/apr/trunk/include/apr_poll.h
apr/apr/trunk/poll/unix/epoll.c
apr/apr/trunk/poll/unix/kqueue.c
apr/apr/trunk/poll/unix/poll.c
apr/apr/trunk/poll/unix/port.c
apr/apr/trunk/poll/unix/select.c
Modified: apr/apr/trunk/poll/unix/epoll.c
URL:
http://svn.apache.org/viewvc/apr/apr/trunk/poll/unix/epoll.c?rev=649830&r1=649829&r2=649830&view=diff
==============================================================================
--- apr/apr/trunk/poll/unix/epoll.c (original)
+++ apr/apr/trunk/poll/unix/epoll.c Sat Apr 19 09:26:39 2008
@@ -263,20 +326,49 @@
}
else {
if (pollset->flags & APR_POLLSET_NOCOPY) {
- for (i = 0; i < ret; i++) {
- pollset->result_set[i] =
- *((apr_pollfd_t *) (pollset->pollset[i].data.ptr));
- pollset->result_set[i].rtnevents =
- get_epoll_revent(pollset->pollset[i].events);
+ for (i = 0, j = 0; i < ret; i++) {
+ fd = *((apr_pollfd_t *) (pollset->pollset[i].data.ptr));
+ /* Check if the polled descriptor is our
+ * wakeup pipe. In that case do not put it result set.
+ */
+ if ((pollset->flags & APR_POLLSET_WAKEABLE) &&
+ fd.desc_type == APR_POLL_FILE &&
+ fd.desc.f == pollset->wakeup_pipe[0]) {
+ drain_wakeup_pipe(pollset);
+ /* XXX: Is this a correct return value ?
+ * We might simply return APR_SUCEESS.
+ */
+ rv = APR_EINTR;
+ }
+ else {
+ pollset->result_set[j] = fd;
+ pollset->result_set[j].rtnevents =
+ get_epoll_revent(pollset->pollset[i].events);
+ j++;
+ }
}
+ (*num) = j;
}
else {
- for (i = 0; i < ret; i++) {
- pollset->result_set[i] =
- (((pfd_elem_t *) (pollset->pollset[i].data.ptr))->pfd);
- pollset->result_set[i].rtnevents =
- get_epoll_revent(pollset->pollset[i].events);
+ for (i = 0, j = 0; i < ret; i++) {
+ fd = (((pfd_elem_t *) (pollset->pollset[i].data.ptr))->pfd);
+ if ((pollset->flags & APR_POLLSET_WAKEABLE) &&
+ fd.desc_type == APR_POLL_FILE &&
+ fd.desc.f == pollset->wakeup_pipe[0]) {
+ drain_wakeup_pipe(pollset);
+ /* XXX: Is this a correct return value ?
+ * We might simply return APR_SUCEESS.
+ */
+ rv = APR_EINTR;
Same question as before: Why should we return APR_EINTR in the case that apart
from our 'wake-up' event there is another event available in the pollset from
one
of our 'real' file descriptors?
IMHO we should return APR_EINTR only in the case where our 'wake-up' event is
the *only* event in the pollset.
Regards
RĂ¼diger