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

Allow acquire timeout to be specified like for threading.Lock #25

Open
jobh opened this issue Aug 20, 2020 · 0 comments
Open

Allow acquire timeout to be specified like for threading.Lock #25

jobh opened this issue Aug 20, 2020 · 0 comments

Comments

@jobh
Copy link

jobh commented Aug 20, 2020

threading.Lock.aquire takes an argument named timeout, using seconds rather than milliseconds with -1 to indicate no timeout.

It would be nice to have a drop-in-compatible interface for pals.Lock.aquire, using something like

def aquire(self, ..., timeout=None):
    if aquire_timeout is None and timeout is not None:
        acquire_timeout = 0 if timeout<0 else 1+int(timeout*1000)

Also, in the same function: It looks like it is not currently possible to override the default aquire_timeout with 0 (no timeout) due to the acquire_timeout or ... construction. It should perhaps be changed to

    acquire_timeout = acquire_timeout if acquire_timeout is not None else self.aquire_timeout
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