refresh users global ch
This commit is contained in:
@@ -6,6 +6,15 @@ import (
|
||||
"mayhem-party/src/device/input/button"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
var (
|
||||
ChanSigUsr1 = func() chan os.Signal {
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGUSR1)
|
||||
return c
|
||||
}()
|
||||
)
|
||||
|
||||
type Refresh struct {
|
||||
@@ -13,13 +22,11 @@ type Refresh struct {
|
||||
input Wrap
|
||||
}
|
||||
|
||||
func NewRefreshCh(sig os.Signal) <-chan os.Signal {
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, sig)
|
||||
return c
|
||||
func NewRefresh(newWrap func() Wrap) *Refresh {
|
||||
return NewRefreshWith(newWrap, ChanSigUsr1)
|
||||
}
|
||||
|
||||
func NewRefresh(newWrap func() Wrap, ch <-chan os.Signal) *Refresh {
|
||||
func NewRefreshWith(newWrap func() Wrap, ch <-chan os.Signal) *Refresh {
|
||||
ctx, can := context.WithCancel(context.Background())
|
||||
result := &Refresh{
|
||||
can: can,
|
||||
|
||||
Reference in New Issue
Block a user