diff --git a/20.01. Programming/Prompting.md b/20.01. Programming/Prompting.md index 9acdc69..2e82c57 100644 --- a/20.01. Programming/Prompting.md +++ b/20.01. Programming/Prompting.md @@ -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. + # 參考來源 \ No newline at end of file