1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 08:32:40 +08:00
This commit is contained in:
2024-05-28 04:23:30 +08:00
parent 1abde30d8f
commit b4ac1cc449
12 changed files with 405 additions and 29 deletions

View File

@ -6,10 +6,17 @@ type ChanLocker interface {
}
type chanSourceLock struct {
m RWLocker
m rwLocker
content map[string]chan int
}
func NewChanSourceLocker() *chanSourceLock {
return &chanSourceLock{
m: NewRWLocker(),
content: make(map[string]chan int),
}
}
func (s *chanSourceLock) Get(key string) (ch <-chan int, ok bool) {
s.m.RLock()
ch, ok = s.content[key]