diff options
-rw-r--r-- | content/race-detector.article | 4 | ||||
-rw-r--r-- | template/root.tmpl | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/content/race-detector.article b/content/race-detector.article index 428ae42..49d5fee 100644 --- a/content/race-detector.article +++ b/content/race-detector.article @@ -81,7 +81,7 @@ It uses [[http://golang.org/pkg/time/#AfterFunc][`time.AfterFunc`]] to create a uses the [[http://golang.org/pkg/time/#Timer.Reset][`Reset`]] method to schedule the next message, re-using the `Timer` each time. -.play race-detector/timer.go /func main/,$ +.play -numbers race-detector/timer.go /func main/,$ This looks like reasonable code, but under certain circumstances it fails in a surprising way: @@ -125,7 +125,7 @@ value to `t` and so the call to `t.Reset` is made with a nil `t`. To fix the race condition we change the code to read and write the variable `t` only from the main goroutine: -.play race-detector/timer-fixed.go /func main/,/^}/ +.play -numbers race-detector/timer-fixed.go /func main/,/^}/ Here the main goroutine is wholly responsible for setting and resetting the `Timer` `t` and a new reset channel communicates the need to reset the timer in diff --git a/template/root.tmpl b/template/root.tmpl index 53ccdba..fb04604 100644 --- a/template/root.tmpl +++ b/template/root.tmpl @@ -141,8 +141,8 @@ <script> $(function() { // Insert line numbers for all playground elements. - $('.playground').each(function() { - var $spans = $(this).find('> pre > span'); + $('.playground > pre.numbers, .code > pre.numbers').each(function() { + var $spans = $(this).find('> span'); // Compute width of number column (including trailing space). var max = 0; |