返回 DeepSeek-Reasonix
filelock_windows.go
根目录 / internal / taskmonitor / filelock_windows.go
1 //go:build windows
2
3 package taskmonitor
4
5 import (
6 "os"
7
8 "golang.org/x/sys/windows"
9 )
10
11 func lockTaskFile(f *os.File) error {
12 var overlapped windows.Overlapped
13 return windows.LockFileEx(windows.Handle(f.Fd()), windows.LOCKFILE_EXCLUSIVE_LOCK, 0, 1, 0, &overlapped)
14 }
15
16 func unlockTaskFile(f *os.File) error {
17 var overlapped windows.Overlapped
18 return windows.UnlockFileEx(windows.Handle(f.Fd()), 0, 1, 0, &overlapped)
19 }
20
20 lines GO