Files

29 lines
448 B
Go

//go:build !linux && !windows
package process
// Lock 获取进程间互斥锁 (非 Linux/Windows: 内存锁)
func (pm *ProcessManager) Lock() error {
pm.mu.Lock()
defer pm.mu.Unlock()
if pm.locked {
return nil
}
pm.locked = true
return nil
}
// Unlock 释放互斥锁 (非 Linux/Windows)
func (pm *ProcessManager) Unlock() error {
pm.mu.Lock()
defer pm.mu.Unlock()
if !pm.locked {
return nil
}
pm.locked = false
return nil
}