File: sync_readdcw_test.go

package info (click to toggle)
golang-github-syncthing-notify 0.0~git20180806.b76b458-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 440 kB
  • sloc: makefile: 3
file content (33 lines) | stat: -rw-r--r-- 946 bytes parent folder | download | duplicates (3)
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
// 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.

// +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)
}