Files
2026-08-17 10:10:14 +08:00

15 lines
617 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Package processlock 提供服务端进程级排他锁,确保同一时刻只有一个 serve 进程持有内核锁。
//
// 锁基于 Linux advisory flock 实现,具体见 lock_linux.go
// 在非 Linux 平台返回 ErrUnsupported(见 lock_unsupported.go)。
package processlock
import "errors"
var (
// ErrAlreadyLocked 表示另一个 serve 进程已经持有内核锁。
ErrAlreadyLocked = errors.New("process lock is already held")
// ErrUnsupported 表示当前操作系统不能运行服务端进程锁。
ErrUnsupported = errors.New("process lock is not supported on this operating system")
)