diff options
Diffstat (limited to 'vendor/github.com')
-rw-r--r-- | vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go b/vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go index fb70de6af..2248a1b12 100644 --- a/vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go +++ b/vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go @@ -26,9 +26,9 @@ import "C" import ( "errors" "os" + "runtime" "sync" "sync/atomic" - "time" "unsafe" ) @@ -63,6 +63,10 @@ var ( func init() { wg.Add(1) go func() { + // There is exactly one run loop per thread. Lock this goroutine to its + // thread to ensure that it's not rescheduled on a different thread while + // setting up the run loop. + runtime.LockOSThread() runloop = C.CFRunLoopGetCurrent() C.CFRunLoopAddSource(runloop, source, C.kCFRunLoopDefaultMode) C.CFRunLoopRun() @@ -73,7 +77,6 @@ func init() { //export gosource func gosource(unsafe.Pointer) { - time.Sleep(time.Second) wg.Done() } |