WinMutex
A simple Python library to create and manage Windows mutexes.
Installation
You can install the library using pip:
pip install winmutex
Usage
Basic Example
from winmutex import WindowsMutex
mutex = WindowsMutex("anidev/winmutex/simple", True) # Name may be any string
mutex.timeout = 2500 # Set a timeout of 2.5 seconds
with mutex:
print(f"[I] Mutex({mutex}) acquired.")
input("Enter to release the mutex and exit> ")
print(f"[I] Mutex({mutex}) released. Exiting...")
Legacy
from winmutex import WindowsMutex
mutex = WindowsMutex("anidev/winmutex/acquire", True) # Name may be any string
if not mutex.acquire(5000): # Acquire the mutex with a timeout of 5 seconds; None for no timeout
print(f"[W] Mutex({mutex}) already exists or acquire timeout exceeded.")
exit(1)
# Do some work while holding the mutex
print(f"[I] Mutex({mutex}) acquired.")
input("Enter to release the mutex and exit> ")
# Release the mutex
mutex.release()
print(f"[I] Mutex({mutex}) released. Exiting...")
License
This project is licensed under the MIT License. See the LICENSE file for details.
Metadata
Release files for winmutex 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| winmutex-1.0.1.tar.gz | 3.7 kB | Without provenance | Details for winmutex-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| winmutex-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for winmutex-1.0.1-py3-none-any.whl |
Total release size: 8.2 kB
Release files / winmutex-1.0.1.tar.gz
| Download URL | winmutex-1.0.1.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
826317aa5c3eedea37bdb3fb908a162a2d086034a4a4b5d5ac3be9d0d0b2dd23
|
|
BLAKE2b-256 checksum How to use checksums |
aaf6ce2f70f42af21ddb17df346462653463b4aacc2f643ce99327f83fb02bf6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.13.2 Windows/11
|
Release files / winmutex-1.0.1-py3-none-any.whl
| Download URL | winmutex-1.0.1-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92a07437c533913947193384c0f5db159aff1b71bff621c1b481869ccb765a47
|
|
BLAKE2b-256 checksum How to use checksums |
62fe9c8dd0db7f3ffe235f758c9bed1d4d42e92e461a0dd1bb0992d81113174e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.13.2 Windows/11
|
Security for winmutex 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.