Skip to content

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

@jobh

Description

@jobh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions