1 Star 0 Fork 0

Stefan/go-zero

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
donechan.go 636 Bytes
Copy Edit Raw Blame History
Stefan authored 2025-06-11 18:20 +08:00 . fix import package
package syncx
import (
"sync"
"gitee.com/emmm_admin/go-zero/core/lang"
)
// A DoneChan is used as a channel that can be closed multiple times and wait for done.
type DoneChan struct {
done chan lang.PlaceholderType
once sync.Once
}
// NewDoneChan returns a DoneChan.
func NewDoneChan() *DoneChan {
return &DoneChan{
done: make(chan lang.PlaceholderType),
}
}
// Close closes dc, it's safe to close more than once.
func (dc *DoneChan) Close() {
dc.once.Do(func() {
close(dc.done)
})
}
// Done returns a channel that can be notified on dc closed.
func (dc *DoneChan) Done() chan lang.PlaceholderType {
return dc.done
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/stefan886/go-zero.git
git@gitee.com:stefan886/go-zero.git
stefan886
go-zero
go-zero
45236c288c2b

Search