重构前最后一份代码(bug较多,请勿使用)

This commit is contained in:
2026-08-07 19:02:44 +08:00
parent fafe07baf8
commit 5bce105bd6
9 changed files with 199 additions and 341 deletions
+28
View File
@@ -0,0 +1,28 @@
//go:build windows
package main
func (pm *ProcessManager) Lock() error {
pm.mu.Lock()
defer pm.mu.Unlock()
if pm.locked {
return nil
}
// Windows 上暂用内存锁模拟(进程间不互斥,仅同一进程内互斥)
// 如需真正的进程间锁,后续可改用 Windows Named Mutex
pm.locked = true
return nil
}
func (pm *ProcessManager) Unlock() error {
pm.mu.Lock()
defer pm.mu.Unlock()
if !pm.locked {
return nil
}
pm.locked = false
return nil
}