Merge pull request #57 from coyove/coyove/fixendian

Fix Poll.Trigger byte order bug under linux
This commit is contained in:
Josh Baker 2019-10-20 18:38:30 -07:00 committed by GitHub
commit 3d2e3575bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -6,6 +6,7 @@ package internal
import ( import (
"syscall" "syscall"
"unsafe"
) )
// Poll ... // Poll ...
@ -44,7 +45,8 @@ func (p *Poll) Close() error {
// Trigger ... // Trigger ...
func (p *Poll) Trigger(note interface{}) error { func (p *Poll) Trigger(note interface{}) error {
p.notes.Add(note) 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 return err
} }