| 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 | // +build windows |
| 6 | |
| 7 | package notify |
| 8 | |
| 9 | import ( |
| 10 | "syscall" |
| 11 | "time" |
| 12 | "unsafe" |
| 13 | ) |
| 14 | |
| 15 | var modkernel32 = syscall.NewLazyDLL("kernel32.dll") |
| 16 | var procSetSystemFileCacheSize = modkernel32.NewProc("SetSystemFileCacheSize") |
| 17 | var zero = uintptr(1<<(unsafe.Sizeof(uintptr(0))*8) - 1) |
| 18 | |
| 19 | func Sync() { |
| 20 | // TODO(pknap): does not work without admin privileges, but I'm going |
| 21 | // to hack it. |
| 22 | // r, _, err := procSetSystemFileCacheSize.Call(none, none, 0) |
| 23 | // if r == 0 { |
| 24 | // dbgprint("SetSystemFileCacheSize error:", err) |
| 25 | // } |
| 26 | } |
| 27 | |
| 28 | // UpdateWait pauses the program for some minimal amount of time. This function |
| 29 | // is required only by implementations which work asynchronously. It gives |
| 30 | // watcher structure time to update its internal state. |
| 31 | func UpdateWait() { |
| 32 | time.Sleep(50 * time.Millisecond) |
| 33 | } |