Jack Andrews wrote: > hi, > > i want to detect IO on a child process stdio as well > as a socket from elsewhere. ie. i want a select() > on /windows/. > > is it possible with APR? or do i have to hack around? >
It's not possible with APR, however you can make a hack if you know its stdin (or stdout, stderr) and you need to know if there is a data pending. #if APR_FILES_AS_SOCKETS static apr_status_t get_file_event(apr_file_t *f, apr_pool_t *pool) { apr_int32_t nd; apr_pollfd_t wait_pollfd; wait_pollfd.p = pool; wait_pollfd.desc_type = APR_POLL_FILE; wait_pollfd.reqevents = APR_POLLIN; wait_pollfd.desc.f = f; return apr_poll(&wait_pollfd, 1, &nd, 0); } #elif defined(WIN32) static apr_status_t get_file_event(apr_file_t *f, apr_pool_t *pool) { HANDLE h; char c; DWORD r; apr_os_file_get(&h, f); if (PeekNamedPipe(h, &c, 1, &r, NULL, NULL)) { if (r == 1) APR_POLLOUT; } return APR_TIMEUP; } #endif This will return APR_POLLOUT if there is data present to be read, or APR_TIMEUP if not. customize at will ;) Regards -- ^(TM)