New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ezlock

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ezlock

Super simple file based locking

  • 0.1.3
  • PyPI
  • Socket score

Maintainers
1

ezlock

Super simple file-based locking:

# first.py
from ezlock import Lock
import time

with Lock():
    print("I got the lock and I'm keeping it for 20s")
    time.sleep(20)
    

and

# second.py
...
with Lock():
    print("Trying to get a lock too")
    

running

>>> python3 first.py &
I got the lock and I'm keeping it for 20s
>>> echo "before 20s"
before 20s
>>> python3 second.py
locking.LockError: Attempted to acquire on already locked lock!

Lock files have an owner. A lock can check if it owns a file with lock.mine. Locks will only release a lock that's not theirs if it's forced i.e. lock.release(force=True).

You can wait for a lock to be released with Lock.wait()

Keywords

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