github.com/misseven0/notify@v0.0.0-20230519123055-c1422e46da05/sync_readdcw_test.go (about) 1 // Copyright (c) 2014-2015 The Notify Authors. All rights reserved. 2 // Use of this source code is governed by the MIT license that can be 3 // found in the LICENSE file. 4 5 //go:build windows 6 // +build windows 7 8 package notify 9 10 import ( 11 "syscall" 12 "time" 13 "unsafe" 14 ) 15 16 var modkernel32 = syscall.NewLazyDLL("kernel32.dll") 17 var procSetSystemFileCacheSize = modkernel32.NewProc("SetSystemFileCacheSize") 18 var zero = uintptr(1<<(unsafe.Sizeof(uintptr(0))*8) - 1) 19 20 func Sync() { 21 // TODO(pknap): does not work without admin privileges, but I'm going 22 // to hack it. 23 // r, _, err := procSetSystemFileCacheSize.Call(none, none, 0) 24 // if r == 0 { 25 // dbgprint("SetSystemFileCacheSize error:", err) 26 // } 27 } 28 29 // UpdateWait pauses the program for some minimal amount of time. This function 30 // is required only by implementations which work asynchronously. It gives 31 // watcher structure time to update its internal state. 32 func UpdateWait() { 33 time.Sleep(50 * time.Millisecond) 34 }