Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'signals' event? #200

Open
codembed opened this issue Mar 18, 2024 · 3 comments
Open

'signals' event? #200

codembed opened this issue Mar 18, 2024 · 3 comments

Comments

@codembed
Copy link

codembed commented Mar 18, 2024

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
Copy link
Collaborator

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
Copy link

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

@reillyeon
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants