Skip to content

CPU to 100% when unable to lock #52

Open
@ilario

Description

@ilario

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions