Initial commit after restructure
This commit is contained in:
23
network/environment/events.go
Normal file
23
network/environment/events.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package environment
|
||||
|
||||
import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
var (
|
||||
networkChangedEventCh = make(chan struct{}, 0)
|
||||
networkChangedEventLock sync.Mutex
|
||||
)
|
||||
|
||||
func triggerNetworkChanged() {
|
||||
networkChangedEventLock.Lock()
|
||||
defer networkChangedEventLock.Unlock()
|
||||
close(networkChangedEventCh)
|
||||
networkChangedEventCh = make(chan struct{}, 0)
|
||||
}
|
||||
|
||||
func NetworkChanged() <-chan struct{} {
|
||||
networkChangedEventLock.Lock()
|
||||
defer networkChangedEventLock.Unlock()
|
||||
return networkChangedEventCh
|
||||
}
|
||||
Reference in New Issue
Block a user