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

SpiDevice: __destruct execution in forks #3

Open
marius-meissner opened this issue Nov 17, 2018 · 0 comments
Open

SpiDevice: __destruct execution in forks #3

marius-meissner opened this issue Nov 17, 2018 · 0 comments

Comments

@marius-meissner
Copy link
Contributor

marius-meissner commented Nov 17, 2018

As found by Volantus/berry-spi#2 (comment) __desctruct of SpiInterface could cause problems in forks, as it might close the socket of the main process during GC of child process.

Normally I would say, that library user has to handle all side effects of forking.
But the only way of handling this, has a huge downside.

Leave everything at it is
Downside: If the process needs to be forked all SPI devices needs to be closed first and reopened after the fork started.

Remove the complete __desctruct logic
Downside: Users have the full responsibility of closing the device before loosing the object reference.

Adding special flag for disabling the __desctruct logic
A setter or flag could be added for enabling/disabling the destruct logic. Maybe the cleanest solution.

Opinions are welcome. Especially maybe of @KiNgMaR.

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

1 participant