mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
fix wait_time docs, tests for trigger deadline greater than or equal to wait deadline
Signed-off-by: redwrasse <mail@redwrasse.io>
This commit is contained in:
parent
9f59ef8ead
commit
5f782c350f
@ -19,9 +19,9 @@ import "sync"
|
||||
type WaitTime interface {
|
||||
// Wait returns a chan that waits on the given logical deadline.
|
||||
// The chan will be triggered when Trigger is called with a
|
||||
// deadline that is later than the one it is waiting for.
|
||||
// deadline that is later than or equal to the one it is waiting for.
|
||||
Wait(deadline uint64) <-chan struct{}
|
||||
// Trigger triggers all the waiting chans with an earlier logical deadline.
|
||||
// Trigger triggers all the waiting chans with an equal or earlier logical deadline.
|
||||
Trigger(deadline uint64)
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ func TestWaitTestStress(t *testing.T) {
|
||||
for i := 0; i < 10000; i++ {
|
||||
chs = append(chs, wt.Wait(uint64(i)))
|
||||
}
|
||||
wt.Trigger(10000 + 1)
|
||||
wt.Trigger(10000 - 1)
|
||||
|
||||
for _, ch := range chs {
|
||||
select {
|
||||
@ -81,6 +81,6 @@ func BenchmarkTriggerAnd10KWaitTime(b *testing.B) {
|
||||
for j := 0; j < 10000; j++ {
|
||||
wt.Wait(uint64(j))
|
||||
}
|
||||
wt.Trigger(10000 + 1)
|
||||
wt.Trigger(10000 - 1)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user