From 04673f038e8f34eacc0ff0b110504a148228cdb1 Mon Sep 17 00:00:00 2001 From: coyove Date: Sun, 22 Sep 2019 19:12:04 +0800 Subject: [PATCH] Fix Poll.Trigger byte order bug under linux --- internal/internal_linux.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/internal_linux.go b/internal/internal_linux.go index 6bbaffa..4607517 100644 --- a/internal/internal_linux.go +++ b/internal/internal_linux.go @@ -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 }