OSDN Git Service

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