octave-maintainers
[Top][All Lists]
Advanced

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

Re: Problem with gnuplot backend + popen2 + non-blocking mode


From: Michael Goffioul
Subject: Re: Problem with gnuplot backend + popen2 + non-blocking mode
Date: Thu, 24 Apr 2008 21:29:20 +0200

On Thu, Apr 24, 2008 at 7:29 PM, John W. Eaton <address@hidden> wrote:
>  I would have expected the pipe that is open for writing to already be
>  in blocking-write mode.  Here is what I see:
>
>   octave:1>   [to_gnuplot, from_gnuplot] = popen2 ("gnuplot")
>   in =  4
>   out =  5
>   octave:2>   bitand (fcntl (to_gnuplot, F_GETFL, 0), O_NONBLOCK)
>   ans = 0
>   octave:3>   bitand (fcntl (from_gnuplot, F_GETFL, 0), O_NONBLOCK)
>   ans =  2048
>
>  Do you also see a non-zero result for the "to_gp" stream?  If so, then
>  does the following patch fix the problem?

I didn't check, but I'm pretty sure it won't change anything
as fcntl does not work under Win32;

>  Instead of fixing the problem in gnuplot_drawnow, maybe the
>  octave_popen2 function for Windows should be fixed to open the writing
>  stream in blocking mode, same as the Unixy popen2 does?

Indeed. I didn't realize that the sync_mode flag only controlled
the read pipe, while the write pipe was always in blocking mode.
The Windows version of popen2 does not do that, it puts both
pipes in non-blocking mode.

Do you want me to propose a patch? Or would you do it
yourself? (it's a only one line to remove, in lo-sysdep.cc,
around line 143; the SetNamedPipeHandleState call for
parentWrite should be removed).

Michael.


reply via email to

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