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

CPU to 100% when unable to lock #52

Open
ilario opened this issue Aug 6, 2024 · 0 comments
Open

CPU to 100% when unable to lock #52

ilario opened this issue Aug 6, 2024 · 0 comments

Comments

@ilario
Copy link

ilario commented Aug 6, 2024

The initial code had a loop inside the TCA9548A_Channel.try_lock() function that was then modified by #39 to be as it appears today:

def try_lock(self) -> bool:
"""Pass through for try_lock."""
while not self.tca.i2c.try_lock():
time.sleep(0)
self.tca.i2c.writeto(self.tca.address, self.channel_switch)
return True

I am using an A64-OLinuXino with a battery pack for controlling the multiplexers.
When there is a power cut, the CPU goes to 100% due to this loop and the battery pack does not last much.

Would it be ok to increase the sleeping time from zero to something else, or even to make it customizable?

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

Successfully merging a pull request may close this issue.

1 participant