Atlas › Test

TestChannelSize_Broadcast

Exact test identity: go.temporal.io/server/common/locks/TestConditionVariableSuite/TestChannelSize_Broadcast

Package
go.temporal.io/server/common/locks
Suite / test hierarchy
TestConditionVariableSuite/TestChannelSize_Broadcast
Test
TestChannelSize_Broadcast
Introduced at
condition_variable_impl.go ×1 Frontier kind: Joint frontier
Covered ranges
3
Covered lines
20
Covered files
1

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/common/locks/condition_variable_impl.go 20 covered LOC · 3 ranges

Open complete file

18 func NewConditionVariable(
19 lock Locker,
20 > ) *ConditionVariableImpl { condition_variable_impl.go
21 > return &ConditionVariableImpl{
22 > lock: lock,
23 >
24 > chanLock: sync.Mutex{},
25 > channel: newCVChannel(),
26 > }
27 > }
28
29 // Signal wakes one goroutine waiting on this condition variable, if there is any.
40
41 // Broadcast wakes all goroutines waiting on this condition variable.
42 > func (c *ConditionVariableImpl) Broadcast() { condition_variable_impl.go
43 > newChannel := newCVChannel()
44 >
45 > c.chanLock.Lock()
46 > defer c.chanLock.Unlock()
47 >
48 > close(c.channel)
49 > c.channel = newChannel
50 > }
51
52 // Wait atomically unlocks user provided lock and suspends execution of the calling goroutine.