[Gambas-user] Opening Pipes (avoiding lockup)

Bruce Steers bsteers4 at gmail.com
Sun Oct 4 12:42:34 CEST 2020


> "Opening a pipe for reading normally blocks until some other process opens
> the same pipe for writing."
> http://gambaswiki.org/wiki/lang/pipe

Doesn't make it right though ;)
And I guess someone agreed because it doesn't do it anymore apparently.


On Sat, 3 Oct 2020 at 21:39, Jussi Lahtinen <jussi.lahtinen at gmail.com>
wrote:

> "Opening a pipe for reading normally blocks until some other process opens
> the same pipe for writing."
> http://gambaswiki.org/wiki/lang/pipe
>
> I don't think you should be able to open pipe for read AND write at the
> same time.
> Benoit?
>
> Jussi
>
>
> On Sat, Oct 3, 2020 at 9:56 PM Bruce Steers <bsteers4 at gmail.com> wrote:
>
>> 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 ]----
>>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20201004/25db340c/attachment.htm>


More information about the User mailing list