Skip to main content

Combo Lock

The combo-lock is a combination of a process lock and a thread lock. Usable in cases both multiple threads and multiple processes are sharing the same resource such as a file in the file system.

The module utilizes the FileLock from filelock and the standard Lock from threading.

The FileLock uses a filesystem lock so the initialization of the class requires a path for the lock file.

Example

from combo_lock import ComboLock

lock = ComboLock('/tmp/my.lock')

with lock:
    write_my_shared_resource()

A NamedLock will save the lock file to shared memory using memory-tempfile

from combo_lock import NamedLock

lock = NamedLock('some_name')

with lock:
    write_my_shared_resource()

History

The combo-lock was originally created for Mycroft-core but as it's been useful in other projects a separate release seemed appropriate.

Metadata

Release files for combo-lock 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for combo-lock 0.3.1
File Size Uploaded
combo_lock-0.3.1.tar.gz 9.1 kB Details

Release files / combo_lock-0.3.1.tar.gz

Download URL combo_lock-0.3.1.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
11527448c6598a3e1aa73381e9d590d9ce3f0544c2f364f3fbfaaae0d2e1d359
BLAKE2b-256 checksum
How to use checksums
e8a5fcf51431606ee64436aeef7f07afeb250ae2b2ad9cd30f2ff7a2de9e667b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.3.1 This release

1 release file

0.3.0

1 release file

0.2.6

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.2

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page