OLD | NEW |
1 // $G $D/$F.go && $L $F.$A && ./$A.out | 1 // run |
2 | 2 |
3 // Copyright 2009 The Go Authors. All rights reserved. | 3 // Copyright 2009 The Go Authors. All rights reserved. |
4 // Use of this source code is governed by a BSD-style | 4 // Use of this source code is governed by a BSD-style |
5 // license that can be found in the LICENSE file. | 5 // license that can be found in the LICENSE file. |
6 | 6 |
7 // This used to crash because the scheduler | 7 // This used to crash because the scheduler |
8 // tried to kick off a new scheduling thread for f | 8 // tried to kick off a new scheduling thread for f |
9 // when time.Nanoseconds went into the system call. | 9 // when time.Nanoseconds went into the system call. |
10 // It's not okay to schedule new goroutines | 10 // It's not okay to schedule new goroutines |
11 // until main has started. | 11 // until main has started. |
12 | 12 |
13 package main | 13 package main |
14 | 14 |
15 import "time" | 15 import "time" |
16 | 16 |
17 func f() { | 17 func f() { |
18 } | 18 } |
19 | 19 |
20 func init() { | 20 func init() { |
21 go f() | 21 go f() |
22 time.Now() | 22 time.Now() |
23 } | 23 } |
24 | 24 |
25 func main() { | 25 func main() { |
26 } | 26 } |
OLD | NEW |