1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-06-10 13:09:11 -04:00

releasble user validator

This commit is contained in:
v2ray
2016-04-25 18:39:30 +02:00
parent c044234e4a
commit 7db14dad9b
4 changed files with 70 additions and 6 deletions

29
common/signal/close.go Normal file
View File

@@ -0,0 +1,29 @@
package signal
type CancelSignal struct {
cancel chan struct{}
done chan struct{}
}
func NewCloseSignal() *CancelSignal {
return &CancelSignal{
cancel: make(chan struct{}),
done: make(chan struct{}),
}
}
func (this *CancelSignal) Cancel() {
close(this.cancel)
}
func (this *CancelSignal) WaitForCancel() <-chan struct{} {
return this.cancel
}
func (this *CancelSignal) Done() {
close(this.done)
}
func (this *CancelSignal) WaitForDone() <-chan struct{} {
return this.done
}