1
// Copyright 2012 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
12
"github.com/gabriel-samfira/sys/windows"
15
// event represents auto-reset, initially non-signaled Windows event.
16
// It is used to communicate between go and asm parts of this package.
21
func newEvent() (*event, error) {
22
h, err := windows.CreateEvent(nil, 0, 0, nil)
26
return &event{h: h}, nil
29
func (e *event) Close() error {
30
return windows.CloseHandle(e.h)
33
func (e *event) Set() error {
34
return windows.SetEvent(e.h)
37
func (e *event) Wait() error {
38
s, err := windows.WaitForSingleObject(e.h, windows.INFINITE)
40
case windows.WAIT_OBJECT_0:
42
case windows.WAIT_FAILED:
45
return errors.New("unexpected result from WaitForSingleObject")