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:
29
common/signal/close.go
Normal file
29
common/signal/close.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user