diff options
Diffstat (limited to 'vendor/codeberg.org/gruf/go-mutexes/cond.go')
-rw-r--r-- | vendor/codeberg.org/gruf/go-mutexes/cond.go | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/vendor/codeberg.org/gruf/go-mutexes/cond.go b/vendor/codeberg.org/gruf/go-mutexes/cond.go deleted file mode 100644 index 3d7f21126..000000000 --- a/vendor/codeberg.org/gruf/go-mutexes/cond.go +++ /dev/null @@ -1,67 +0,0 @@ -package mutexes - -import ( - "sync" -) - -// Cond is similar to a sync.Cond{}, but -// it encompasses the Mutex{} within itself. -type Cond struct { - c sync.Cond - sync.Mutex -} - -// See: sync.Cond{}.Wait(). -func (c *Cond) Wait() { - if c.c.L == nil { - c.c.L = &c.Mutex - } - c.c.Wait() -} - -// See: sync.Cond{}.Signal(). -func (c *Cond) Signal() { - if c.c.L == nil { - c.c.L = &c.Mutex - } - c.c.Signal() -} - -// See: sync.Cond{}.Broadcast(). -func (c *Cond) Broadcast() { - if c.c.L == nil { - c.c.L = &c.Mutex - } - c.c.Broadcast() -} - -// RWCond is similar to a sync.Cond{}, but -// it encompasses the RWMutex{} within itself. -type RWCond struct { - c sync.Cond - sync.RWMutex -} - -// See: sync.Cond{}.Wait(). -func (c *RWCond) Wait() { - if c.c.L == nil { - c.c.L = &c.RWMutex - } - c.c.Wait() -} - -// See: sync.Cond{}.Signal(). -func (c *RWCond) Signal() { - if c.c.L == nil { - c.c.L = &c.RWMutex - } - c.c.Signal() -} - -// See: sync.Cond{}.Broadcast(). -func (c *RWCond) Broadcast() { - if c.c.L == nil { - c.c.L = &c.RWMutex - } - c.c.Broadcast() -} |