Fix Poll.Trigger byte order bug under linux

This commit is contained in:
coyove 2019-09-22 19:12:04 +08:00
parent b353be3a76
commit 04673f038e
1 changed files with 3 additions and 1 deletions

View File

@ -6,6 +6,7 @@ package internal
import (
"syscall"
"unsafe"
)
// Poll ...
@ -44,7 +45,8 @@ func (p *Poll) Close() error {
// Trigger ...
func (p *Poll) Trigger(note interface{}) error {
p.notes.Add(note)
_, err := syscall.Write(p.wfd, []byte{0, 0, 0, 0, 0, 0, 0, 1})
var x uint64 = 1
_, err := syscall.Write(p.wfd, (*(*[8]byte)(unsafe.Pointer(&x)))[:])
return err
}