Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3603)

Delta Between Two Patch Sets: src/pkg/time/tick_test.go

Issue 4063043: code review 4063043: time: allow cancelling of After events. (Closed)
Left Patch Set: code review 4063043: time: allow cancelling of After events. Created 13 years, 2 months ago
Right Patch Set: code review 4063043: time: allow cancelling of After events. Created 13 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/time/sleep_test.go ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package time_test 5 package time_test
6 6
7 import ( 7 import (
8 "testing" 8 "testing"
9 . "time" 9 . "time"
10 ) 10 )
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 37
38 // Test that a bug tearing down a ticker has been fixed. This routine should no t deadlock. 38 // Test that a bug tearing down a ticker has been fixed. This routine should no t deadlock.
39 func TestTeardown(t *testing.T) { 39 func TestTeardown(t *testing.T) {
40 for i := 0; i < 3; i++ { 40 for i := 0; i < 3; i++ {
41 ticker := NewTicker(1e8) 41 ticker := NewTicker(1e8)
42 <-ticker.C 42 <-ticker.C
43 ticker.Stop() 43 ticker.Stop()
44 } 44 }
45 } 45 }
46
47 func BenchmarkTicker(b *testing.B) {
48 ticker := NewTicker(1)
49 b.ResetTimer()
50 b.StartTimer()
51 for i := 0; i < b.N; i++ {
52 <-ticker.C
53 }
54 b.StopTimer()
55 ticker.Stop()
56 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b