[Gambas-user] Opening Pipes (avoiding lockup)

Bruce Steers bsteers4 at gmail.com
Sun Oct 4 14:04:31 CEST 2020


I put the Simple Pipe Example on the app page.
http://gambaswiki.org/wiki/app/simple-pipe

> I have no locking problem with opening a pipe for reading and watching.
> Please post your project and tell which version of Gambas you are using.

I just did some tests...
That posted version I put on the wiki uses the echo trick and has
GB_PCODE_VERSION=3.8 set.
It works running it on gambas 3.15 and on 3.12

If i remove the echo trick it then only runs on a 3.15 gbr3 and hangs on a
lesser version.
I feel i've narrowly avoided a trap there :)

Sorry to be the one keep referring to the lesser versions of gambas that
i'm sure you've moved beyond but sadly though the rest of the world haven't
moved on yet.

I don't think this post even warrants a reply now as I was thinking i was
doing something wrong when opening a pipe but it seems not, the pipe did
lock and now it doesn't so problem solved in that respect. (Nice one Benoit)
It just leaves a backward compatibility issue that with the echo trick i've
used resolves the issue i guess.

Cheers all
Bruce Steers

On Sat, 3 Oct 2020 at 23:08, Benoît Minisini <g4mba5 at gmail.com> wrote:

> Le 03/10/2020 à 20:55, Bruce Steers a écrit :
> > Hi all.
> > I just uploaded a simple pipe opening/watching routing to the
> > Application section as an example.
> > The reason for this was because it took me quite some time to figure out
> > how to get a pipe working at first and thought many others may have hit
> > the same brick wall. It seemed EVERYTHING I tried just locked up the app
> > til the pipe got some text sent, then everything was okay, the app could
> > run and the File_Read() event would trigger on any more text sent as
> > expected.
> >
> > What was not expected is that "Opening" the pipe is like calling a Read
> > method that locks the program till it gets some text.
> > I came up with a simple solution (eventually) to use the Shell command
> > to echo a blank line to the pipe just before opening it...
> >
> >   Shell "echo '' >/tmp/FIFO1"
> >   hFile = Pipe "/tmp/FIFO1" For Read Watch
> >
> > That way when the pipe opens it gets the echo and moves on so the
> > program continues running.
> > It just seemed wrong though.
> > Like either i was doing something wrong in how i was opening the pipe or
> > it was a bug in the pipe opening call?
> > I would have thought that setting the "Watch" option would open the pipe
> > without expecting text and just set up the Read event and move on.
> >
> > I found using "Read Write Watch" all together and setting Blocking to
> > False Allowed the program to move past the open without sending text but
> > that gave me weird errors like pop-up menus stopped triggering Click()
> > events, I had some menus visible in the menubar AND attached to a button
> > popup and got the click event okay from the top menu but got nothing
> > from the popup menus. If i removed the "Write" from the pipe opening
> > call the popups worked again!?
> > I found the Shell "echo" method the best way but like i say , seems
> > wrong to have to do it that way.
> >
> > Thanks all :)
> >
> >
> >
> > ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> >
>
> I have no locking problem with opening a pipe for reading and watching.
> Please post your project and tell which version of Gambas you are using.
>
> Regards,
>
> --
> Benoît Minisini
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20201004/e0514353/attachment.htm>


More information about the User mailing list