Documentation
¶
Overview ¶
Package lock provides an advisory file lock around the critical section that mutates tasks.txt (SPEC §6.4). It locks a dedicated lock file — never tasks.txt itself — so the atomic rename that replaces tasks.txt can't swap the inode out from under a held lock.
The OS primitive differs per platform: flock(2) on Unix, LockFileEx on Windows (see lock_unix.go / lock_windows.go). Both are advisory and released automatically when the file handle closes or the process exits, so a crash can't strand the store. Both are local-filesystem only; on NFS/SMB the lock may silently no-op, so the store is documented as local-FS only for concurrent access.
Index ¶
Constants ¶
const DefaultTimeout = 2 * time.Second
DefaultTimeout bounds how long Acquire waits before reporting the store busy.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle is a held lock. Release must be called (typically via defer).