Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: common/clock/timer.go

Issue 1679023005: Add Context cancellation to clock. (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Much more invasive, cancel by default, remove meter package. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package clock 5 package clock
6 6
7 import ( 7 import (
8 "time" 8 "time"
9 ) 9 )
10 10
11 // Timer is a wrapper around the time.Timer structure. 11 // Timer is a wrapper around the time.Timer structure.
12 // 12 //
13 // A Timer is instantiated from a Clock instance and started via its Reset() 13 // A Timer is instantiated from a Clock instance and started via its Reset()
14 // method. 14 // method.
15 type Timer interface { 15 type Timer interface {
16 » // GetC returns the underlying timer's channel, or nil if the timer is n o 16 » // GetC returns the underlying timer's channel.
17 » // running. 17 » GetC() <-chan AfterResult
18 » GetC() <-chan time.Time
19 18
20 // Reset configures the timer to expire after a specified duration. 19 // Reset configures the timer to expire after a specified duration.
21 // 20 //
22 // If the timer is already running, its previous state will be cleared a nd 21 // If the timer is already running, its previous state will be cleared a nd
23 // this method will return true. 22 // this method will return true.
24 Reset(d time.Duration) bool 23 Reset(d time.Duration) bool
25 24
26 // Stop clears any timer tasking, rendering it inactive. 25 // Stop clears any timer tasking, rendering it inactive.
27 // 26 //
28 // Stop may be called on an inactive timer, in which case nothing will h appen 27 // Stop may be called on an inactive timer, in which case nothing will h appen
29 // If the timer is active, it will be stopped and this method will retur n true. 28 // If the timer is active, it will be stopped and this method will retur n true.
30 Stop() bool 29 Stop() bool
31 } 30 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698