[Gambas-user] using events of serial ports for reading how_?

T Lee Davidson t.lee.davidson at gmail.com
Tue Aug 7 18:05:52 CEST 2018


Maybe using those events is another way to do what exactly? Even if any of them signal that data is available, the _Read event
already does that for you.

I must have missed what you are trying to accomplish by doing a manual read.

Perhaps your goal could be accomplished by implementing a SerialPort.Read event handler that adds the incoming data to a global
accumulator, and then manually reading the accumulator and clearing it once it's read.

However, that may run into collisions and data integrity issues if you try to manually read from, or clear, the accumulator
while the event handler is writing to it. I am unfamiliar with how event handlers are managed within the event loop, so I am
unsure whether or not using a semaphore could prevent such collisions.

Or, maybe using a Queue would meet your need: http://gambaswiki.org/wiki/comp/gb.data/queue . (It's unfortunate that there's not
much documentation on that.)


___
Lee


On 08/06/2018 05:10 PM, PICCORO McKAY Lenz wrote:
> i'll try to use your semaphore, but there's another way maybe using the CTSChange
> DCDChange DSRChange DTRChange RNGChange RTSChange
> ??


More information about the User mailing list