From 413fc7880570a60e608134da842140e73cb5ab7a Mon Sep 17 00:00:00 2001 From: Caleb Martinez Date: Mon, 9 Jul 2018 14:44:10 -0400 Subject: [PATCH 1/4] add clarification to Stop() documentation --- src/time/tick.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/time/tick.go b/src/time/tick.go index 3d693206a53218..cbfcaa331036f3 100644 --- a/src/time/tick.go +++ b/src/time/tick.go @@ -40,8 +40,9 @@ func NewTicker(d Duration) *Ticker { } // Stop turns off a ticker. After Stop, no more ticks will be sent. -// Stop does not close the channel, to prevent a read from the channel succeeding -// incorrectly. +// Stop does not close the channel; this is in order to prevent potential +// side effects, such as a goroutine concurrently reading from the channel +// and the read succeeding incorrectly. func (t *Ticker) Stop() { stopTimer(&t.r) } From 433b0525b85fbe6659d70fe8fc97adc648280ad0 Mon Sep 17 00:00:00 2001 From: Caleb Martinez Date: Mon, 9 Jul 2018 23:58:11 -0400 Subject: [PATCH 2/4] Adjusted comment on Time.Stop --- src/time/tick.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/time/tick.go b/src/time/tick.go index cbfcaa331036f3..a11651e8d524c5 100644 --- a/src/time/tick.go +++ b/src/time/tick.go @@ -40,9 +40,7 @@ func NewTicker(d Duration) *Ticker { } // Stop turns off a ticker. After Stop, no more ticks will be sent. -// Stop does not close the channel; this is in order to prevent potential -// side effects, such as a goroutine concurrently reading from the channel -// and the read succeeding incorrectly. +// Stop does not close the channel. This prevents a concurrent goroutine (reading from said channel) from succeeding incorrectly. func (t *Ticker) Stop() { stopTimer(&t.r) } From 3a9d4ecb9313a8569c720a4bd95e5e06bdfcc425 Mon Sep 17 00:00:00 2001 From: Caleb Martinez Date: Tue, 10 Jul 2018 09:31:49 -0400 Subject: [PATCH 3/4] More adjustments to Time.Stop comment --- src/time/tick.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/time/tick.go b/src/time/tick.go index a11651e8d524c5..f32bf58f61339d 100644 --- a/src/time/tick.go +++ b/src/time/tick.go @@ -40,7 +40,8 @@ func NewTicker(d Duration) *Ticker { } // Stop turns off a ticker. After Stop, no more ticks will be sent. -// Stop does not close the channel. This prevents a concurrent goroutine (reading from said channel) from succeeding incorrectly. +// Stop does not close the channel. This prevents a concurrent goroutine +// (reading from said channel) from seeing a read succeed incorrectly. func (t *Ticker) Stop() { stopTimer(&t.r) } From e4649847e015e573ee169c7d6db29b9437841afd Mon Sep 17 00:00:00 2001 From: Caleb Martinez Date: Wed, 11 Jul 2018 09:39:28 -0400 Subject: [PATCH 4/4] update Timer.Stop documentation --- src/time/tick.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/time/tick.go b/src/time/tick.go index f32bf58f61339d..e4cd43aa82aef5 100644 --- a/src/time/tick.go +++ b/src/time/tick.go @@ -40,8 +40,8 @@ func NewTicker(d Duration) *Ticker { } // Stop turns off a ticker. After Stop, no more ticks will be sent. -// Stop does not close the channel. This prevents a concurrent goroutine -// (reading from said channel) from seeing a read succeed incorrectly. +// Stop does not close the channel, to prevent a concurrent goroutine +// reading from the channel from seeing an erroneous "tick". func (t *Ticker) Stop() { stopTimer(&t.r) }