apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <...@rkbloom.net>
Subject Re: Poll() problem
Date Sat, 05 Jun 2004 10:06:35 GMT

What platform are you on?  Polling on file descriptors isn't available on
all platforms, because not all of the underlying platforms support it.  I
believe that Windows, for example, can't do it, at least not with the
functions that we are using.  (although I know we have solved this somehow
for pipes, because we must poll in mod_cgi.)

Ryan

On Sat, 5 Jun 2004, Damir Dezeljin wrote:

> Hi.
>
>
> I would like to use poll() functions to check for available data on read
> part of a pipe to avoid blocked read. Unfortunately I can't get it
> working. When executing an apr_pollset_add(), I always get 'Bad file
> descriptor' error.
>
>
> So I created a simplest pice of code and tried with it. Unfortunately also
> it doesn't work. Do anyone have a clue what is going on (what I made wrong
> ? :) ):
> ----
> apr_pollset_t *pSet_p=NULL;
> apr_pollfd_t pollfd;
> apr_file_t *aFd=NULL;
>
> aRv = apr_file_open(&aFd, "c:\\test.txt", APR_READ, APR_UREAD, pool_p);
> APR_CHECK_ERR(aRv);
>
> /* The below line is working fine if uncomented
>  * aRv = apr_file_read(aFd, buf, &len);
>  * APR_CHECK_ERR(aRv);
>  */
>
> aRv = apr_pollset_create(&pSet_p, 1, pool_p, 0);
> APR_CHECK_ERR(aRv);
>
> // BTW: is the below line necesary (it doesn't matter
> //      anyway it doesn't work.
> // pollfd.p         = pool_p;
> pollfd.desc_type    = APR_POLL_FILE;
> pollfd.reqevents    = APR_POLLNVAL | APR_POLLIN | APR_POLLOUT;
> pollfd.desc.f       = aFd;
>
> aRv = apr_pollset_add(pSet_p, &pollfd);
> APR_CHECK_ERR(aRv);   // Tu javi error
> ----
>
>
> Regards,
> Dezo
>
>


Mime
View raw message