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

closing serial port causes close eventloop and shutdown #172

Open
dafik opened this issue Jun 22, 2023 · 3 comments
Open

closing serial port causes close eventloop and shutdown #172

dafik opened this issue Jun 22, 2023 · 3 comments

Comments

@dafik
Copy link

dafik commented Jun 22, 2023

I have several gpio listeners
when call serial.close() gpio listeners are closed
INFO com.diozero.internal.provider.builtin.gpio.GpioChip::eventLoop - Event loop finished

probably by this :
raise(SIGINT);
in native utils
https://github.com/mattjlewis/diozero/blob/main/system-utils-native/src/main/c/com_diozero_internal_provider_builtin_serial_NativeSerialDevice.c#L381

having serial port open all time causes 100% cpu utilisation.

@mattjlewis
Copy link
Owner

Will take a look.

@dafik
Copy link
Author

dafik commented May 28, 2024

any progess on this ?

@mattjlewis
Copy link
Owner

Apologies - not a simple fix - the current implementation settled on a blocking read to replicate behaviour similar to Java I/O. I added the SIGINT to interrupt any remaining blocking reads but clearly didn't fully think through the implications. I suspect I will need to switch to an event based read model under the hood to maintain the same exposed API in SerialDevice which will be a bit more complicated.

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

2 participants