//go:build windows package queue import ( "errors" "syscall" ) // processAlive on Windows cannot use the kill(0) trick: os.FindProcess // always returns a non-nil process and Signal(0) is unsupported. We // conservatively report every pid as alive and rely on the mtime // staleness window in lockIsStale to recover from a crashed run. func processAlive(pid int) bool { return true } // errorSharingViolation (ERROR_SHARING_VIOLATION, 0x20) is not exported // by the syscall package, so it is named locally. const errorSharingViolation = syscall.Errno(0x20) // isPendingDelete reports whether err is the transient rejection Windows // raises when an exclusive create targets a lock file still in "delete // pending" state — another invocation released it microseconds ago while // a staleness probe held an open read handle. CreateFile returns // ERROR_ACCESS_DENIED (or ERROR_SHARING_VIOLATION while a stray handle is // still open) rather than reporting the file as existing, so acquireLock // must treat it as contention, not a hard error. func isPendingDelete(err error) bool { return errors.Is(err, syscall.ERROR_ACCESS_DENIED) || errors.Is(err, errorSharingViolation) }