[>] pywinmutex > winmutex

This commit is contained in:
2025-04-02 14:03:37 +03:00
parent 420e352745
commit f2ed9af99f
7 changed files with 17 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
from pywinmutex import WindowsMutex
from winmutex import WindowsMutex
mutex = WindowsMutex("anidev/pywinmutex/acquire", True) # Name may be any string
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.")

View File

@@ -1,4 +1,4 @@
from pywinmutex import WindowsMutex
from winmutex import WindowsMutex
mutex_name = "anidev.myapp.mutex.{}" # Name constructor
mutex = WindowsMutex(mutex_name.format(0), True)

View File

@@ -1,6 +1,6 @@
from pywinmutex import WindowsMutex
from winmutex import WindowsMutex
mutex = WindowsMutex("anidev/pywinmutex/simple", True) # Name may be any string
mutex = WindowsMutex("anidev/winmutex/simple", True) # Name may be any string
mutex.timeout = 2500 # Set a timeout of 2.5 seconds
with mutex: