File: sync_readdcw_test.go

package info (click to toggle)
golang-github-rjeczalik-notify 0.9.3-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 468 kB
  • sloc: makefile: 2
file content (34 lines) | stat: -rw-r--r-- 965 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) 2014-2015 The Notify Authors. All rights reserved.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

//go:build windows
// +build windows

package notify

import (
	"syscall"
	"time"
	"unsafe"
)

var modkernel32 = syscall.NewLazyDLL("kernel32.dll")
var procSetSystemFileCacheSize = modkernel32.NewProc("SetSystemFileCacheSize")
var zero = uintptr(1<<(unsafe.Sizeof(uintptr(0))*8) - 1)

func Sync() {
	// TODO(pknap): does not work without admin privileges, but I'm going
	// to hack it.
	// r, _, err := procSetSystemFileCacheSize.Call(none, none, 0)
	// if r == 0 {
	//   dbgprint("SetSystemFileCacheSize error:", err)
	// }
}

// UpdateWait pauses the program for some minimal amount of time. This function
// is required only by implementations which work asynchronously. It gives
// watcher structure time to update its internal state.
func UpdateWait() {
	time.Sleep(50 * time.Millisecond)
}