[Gambas-user] gbx3, how and where to handle POLLHUP event ?

Benoît Minisini g4mba5 at gmail.com
Sat Mar 21 16:31:21 CET 2020


Le 21/03/2020 à 13:58, Benoît Minisini a écrit :
> Le 21/03/2020 à 09:34, Peter Bauer a écrit :
>> Hello,
>> In which source file does gbx handle poll() callbacks to watch open 
>> files ?
>>
>> High CPU load and fast repeating output from strace attached to gbx3 
>> process:
>> poll([ {fd= 6, events = POLLIN}, {fd= 7, events = POLLIN}, {fd= 8, 
>> events = POLLIN |POLLPRI}, {fd=13, events=POLLIN}], 4, 989) = 1 
>> ([{fd=13, revents=POLLHUP}])
>>
>> Gambas example:
>> https://gambas.one/gambasfarm/?id=761&action=search
>> (must be run from a terminal to show the issue,issue not visible in 
>> gambas IDE !)
>>
>> I would like to look if it is possible to handle an incoming pipe when 
>> the sender
>> process has ended. In this case the pipe should no longer be watched 
>> and just be closed and/or an error should be thrown. I found a C 
>> source code example for this:
>> https://stackoverflow.com/questions/5857461/how-to-use-the-poll-c-function-to-watch-named-pipes-in-linux/44126952#44126952 
>>
> 
> I will look at it.
> 
> Two remarks first:
> 
> - Why did you put the gbx3 executable inside your project???
> 
> - The event loop depends on the GUI component, so the behaviour is 
> different between a command-line application, a QT application and a 
> GTK+ application.
> 
> I wrote the interpreter event loop, but not the QT or GTK+ one, so maybe 
> the problem comes from that difference.
> 
> Regards,
> 

I confirm that with gb.gtk it eats 100% CPU. With gb.qt only 1.0%.

Regards,

-- 
Benoît Minisini


More information about the User mailing list