[Gambas-user] Happy new year...

Benoît Minisini gambas at ...1...
Fri Jan 2 03:05:03 CET 2015


Le 02/01/2015 02:53, Jussi Lahtinen a écrit :
>> There are actually two problems in your test:
>>
>> 1) What is watched is not a file path, but a file descriptor. The
>> command "echo test > XXX" replace the "XXX" file by a new file with the
>> same name, and that file is not opened nor watched by the test.
>>
>
> Oh, I see... however the problem persist if I change to to appending:
> Shell "echo test > " & sTemp Wait
>   -->
> Shell "echo test >> " & sTemp Wait
>

This is because of the point 2)

>
>
> 2) Once the end of file is reached, Gambas automatically stops the
>> watch, even if new data is added to the file later. This behaviour is
>> not a good idea, and I think I did it because sometimes file descritor
>> keep being ready to read even if there is no data anymore.
>>
>
> Yeah, think it breaks the example given in the documentation (watching a
> serial port).
>
>
>
> Jussi

If I don't stop watching a file descriptor when end of file is reached, 
I get 100% CPU use when watching a file, as they are always "ready to read".

But If I stop watching, you can't write code that waits for data on a 
file descriptor that does not receive it.

I may have a solution... I hope it won't break everything!

-- 
Benoît Minisini




More information about the User mailing list