From 3ae1c245c4593e92f953b1ad0d44793567281049 Mon Sep 17 00:00:00 2001 From: Brian Havard Date: Mon, 12 Apr 2010 18:10:48 +0000 Subject: Hide apr_wait_for_io_or_timeout() from public view and add instead apr_socket_wait() and apr_file_pipe_wait(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@933338 13f79535-47bb-0310-9956-ffa450edef68 --- support/os2/waitio.c | 41 ++--------------------------------------- 1 file changed, 2 insertions(+), 39 deletions(-) (limited to 'support') diff --git a/support/os2/waitio.c b/support/os2/waitio.c index e799b2711..60530e732 100644 --- a/support/os2/waitio.c +++ b/support/os2/waitio.c @@ -19,51 +19,14 @@ #include "apr_errno.h" #include "apr_support.h" -static apr_status_t wait_for_file(apr_file_t *f, int for_read) -{ - int rc; - - if (!f->pipe) { - /* No support for waiting on a regular file */ - return APR_ENOTIMPL; - } - - rc = DosWaitEventSem(f->pipeSem, f->timeout >= 0 ? f->timeout / 1000 : SEM_INDEFINITE_WAIT); - - if (rc == ERROR_TIMEOUT) { - return APR_TIMEUP; - } - - return APR_FROM_OS_ERROR(rc); -} - - - -static apr_status_t wait_for_socket(apr_socket_t *s, int for_read) -{ - int pollsocket = s->socketdes; - int wait_rc = select(&pollsocket, for_read != 0, for_read == 0, 0, s->timeout / 1000); - - if (wait_rc == 0) { - return APR_TIMEUP; - } - else if (wait_rc < 0) { - return APR_FROM_OS_ERROR(sock_errno()); - } - - return APR_SUCCESS; -} - - - apr_status_t apr_wait_for_io_or_timeout(apr_file_t *f, apr_socket_t *s, int for_read) { if (f) { - return wait_for_file(f, for_read); + return apr_file_pipe_wait(f, for_read ? APR_WAIT_READ : APR_WAIT_WRITE); } else if (s) { - return wait_for_socket(s, for_read); + return apr_socket_wait(s, for_read ? APR_WAIT_READ : APR_WAIT_WRITE); } /* Didn't specify a file or socket */ -- cgit v1.2.1