help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: filesize of fifo


From: John W. Eaton
Subject: Re: filesize of fifo
Date: Mon, 5 Feb 2001 17:11:50 -0600

On 31-Jan-2001, Paul Kienzle <address@hidden> wrote:

| The better way is to make the read-end of your fifo non-blocking:
|    fid = fopen("fifo", "r"); 
|    fcntl(fid, F_SETFL, O_NONBLOCK);
| It appears that O_NONBLOCK must be set immediately after opening.
| Note that the fopen call will block until the write-end has been opened.
| 
| Now you can do fread/fgets calls as normal.  However, if you ever run out
| of input, then Octave will think that you have encountered an end of file
| and will refuse to try to read any more.  As a workaround, you can close
| and reopen the file and it will work as normal (with only a 4 ms overhead
| on my Pentium 166), but this is ugly.  Anyone know what's going on?

Octave doesn't really have all it needs to properly do nonblocking
I/O.  You would probably want to be able to call read (or fread) and
have it not set EOF if there is nothing to read.  You would probably
want to be able to check errno to see if it was set to EAGAIN (if read
returns -1 and errno is set to this, it means that there was nothing
to read, so you would want to wait and try again later).  And, you
might also want to have access to select().

jwe



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]