Socket
Socket
Sign inDemoInstall

combo-lock

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

combo-lock

A combined process and thread lock


Maintainers
3

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.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc