Replace lockfile context mgr usage with lock.aquire() and lock.release() #111
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
On RP2 Linux we have a deadlock when using root account so we may want to drop mocking feature but have non-blocking mbed-ls with timeout=.5 sec on file lock acquire.
Rationale
To catch LockTImeout exception we can't use context mgr. We need to use explicit
calls to
acquire(timeout=1)andrelease()to catch timeout.Timeout may occur on some Resource Managers instance.
LockFile objects support the context manager protocol used by the statement:with
statement. The timeout option is not supported when used in this fashion. While
support for timeouts could be implemented, there is no support for handling the
eventual Timeout exceptions raised by the enter() method, so you would have
to protect the with statement with a try statement. The resulting construct
would not be any simpler than just using a try statement in the first place.
Example timeout