[Gambas-user] Why 100% CPU load on file OPEN with WATCH if data comes from a pipe ?
Benoît Minisini
g4mba5 at gmail.com
Wed Feb 19 00:17:22 CET 2020
Le 19/02/2020 à 00:10, Peter Bauer a écrit :
> Hello,
> Gambas 3.14, When piping like this: (program listing is on the end !)
> >echo ABC | ./input_reader.gambas /* pipe just 3 chars
> I see permanent 100% CPU load(with top) on Ubuntu 18.04.01.
> When using from terminal like this, there is no high CPU load:
> >$./input_reader.gambas
> >ABC /* type some text on the terminal
>
> So for the moment it does not make sense to use the File_Read() event
> handler with piped input. Could it be a problem with WATCH ? To
> reproduce please build with "make executable" and then run from the
> terminal. I do not see the problem when running from the Gambas IDE. Is
> there a workaround ?
>
> BR,
> Peter
>
> Listing ./input_reader.gambas:
> ' Gambas class file
>
> Static Public hFile1 As Stream
> Static Public sline As String
>
> Public Sub Form_Open()
> hFile1 = Open "/dev/stdin" For Input Watch
> hFile1.Blocking = False
> End
>
> Public Sub Form_Close()
> hFile1.close
> End
>
> Public Sub File_Read() ' File Read event handler
> While Not Eof(hFile1)
> Line Input #hFile1, sLine
> TextArea1.Insert(sLine & gb.NewLine)
> Wend
> End
>
> Public Sub Timer1_Timer() 'with 100 ms
> TextArea1.EnsureVisible()
> TextArea1.Refresh
> End
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
Please send your full project.
Regards,
--
Benoît Minisini
More information about the User
mailing list