WICG / serial

Serial ports API for the platform.
https://wicg.github.io/serial/
Other
255 stars 46 forks source link

'signals' event? #200

Open codembed opened 3 months ago

codembed commented 3 months ago

I am wondering if a SerialPort 'signals' event was ever considered - to complement getSignals. To detect changes on RI, DCD and DSR (and CTS), the application needs to continually poll by invoking getSignals. I guess one can just poll with getSignals() every 100-500ms or so, but it seems to diverge from good asynchronous programming.

Was a SerialPort 'signals' or 'signalschange' event overlooked, or intentionally omitted for simplicity?

reillyeon commented 3 months ago

I considered it but if I recall correctly Windows provides an API to listen for changes to these signals but POSIX (Linux and macOS) does not.

sn4kebite commented 2 months ago

On Linux at least there's the TIOCMIWAIT operation for ioctl that accomplishes this.

reillyeon commented 2 months ago

On Linux at least there's the TIOCMIWAIT operation for ioctl that accomplishes this.

If you spawn a thread exclusively for the purpose of waiting for signals. POSIX has frustratingly poor support for asynchronous I/O.