vault backup: 2025-03-18 08:43:56

Affected files:
20.01. Programming/Prompting.md
This commit is contained in:
2025-03-18 08:43:56 +08:00
parent ea805b8754
commit 5dc08ee680

View File

@@ -18,5 +18,13 @@ Add docstring in English to each classes and functions.
編譯環境: Visual Studio 2022
Python 版本: 3.12
# Create global mutex
Use `ctypes` and Win32Api `CreateMutex` to create a global mutex here. Use class to wrap it.
This mutex shoid has these features:
1. When user instantiate this class, use Win32api `OpenMutex` to try to open this global mutex, because this mutex mybe alreday created in another process.
2. if `OpenMutex` failed, use `CreateMutex` to create the global mutex.
3. this class should provide lock and unlock function, use `WaitForSingleObject` and `ReleaseMutex` to implement it.
4. And, very important, class should has `release` function of mutex.
# 參考來源