diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2007-10-14 06:00:00 +0000 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2007-10-14 06:00:00 +0000 |
commit | 8647a7de7dac8f0fe9ea62c6eb38a2673939af0d (patch) | |
tree | d1d1f32e608560121dd04193cdb6b00d25a58814 /file_io/os2 | |
parent | 29878d1b430c3e8205e284a50d7528b39325f2ed (diff) | |
download | apr-8647a7de7dac8f0fe9ea62c6eb38a2673939af0d.tar.gz |
Enhance our file_io in APR 1.3 with apr_file_pipe_create_ex(),
which should replace apr_file_pipe_create() in apr 2.0. Trivial,
this sets up blocking and nonblocking flavors of either pipe end.
Obviously this code shrinks up threadproc/*/proc.c quite nicely.
This eliminates a major class of portability concerns. On Win32,
I take this one step further and fix the pipe creation logic so
that nonblock pipes are always set to timeout of 0, per Eric's
earlier proc.c patch.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@584487 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/os2')
-rw-r--r-- | file_io/os2/pipe.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/file_io/os2/pipe.c b/file_io/os2/pipe.c index ee2b2b004..15eb7c262 100644 --- a/file_io/os2/pipe.c +++ b/file_io/os2/pipe.c @@ -104,6 +104,35 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out +APR_DECLARE(apr_status_t) apr_file_pipe_create_ex(apr_file_t **in, + apr_file_t **out, + apr_int32_t blocking, + apr_pool_t *pool) +{ + apr_status_t status; + + if ((status = apr_file_pipe_create(in, out, attr->pool)) + != APR_SUCCESS) { + return status; + } + + switch (blocking) { + case APR_FULL_BLOCK: + break; + case APR_READ_BLOCK: + apr_file_pipe_timeout_set(*in, 0); + break; + case APR_WRITE_BLOCK: + apr_file_pipe_timeout_set(*out, 0); + break; + default: + apr_file_pipe_timeout_set(*in, 0); + apr_file_pipe_timeout_set(*out, 0); + } +} + + + APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename, apr_fileperms_t perm, apr_pool_t *pool) { /* Not yet implemented, interface not suitable */ |