diff options
| author | Russ Cox <rsc@golang.org> | 2011-10-27 18:04:12 -0700 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2011-10-27 18:04:12 -0700 |
| commit | 6808da0163a353f7c4d871a215417e0da4db71f8 (patch) | |
| tree | 9a1730b2a5120ac968c93b899a830217c88ccd76 /src/pkg/runtime/amd64 | |
| parent | 32f3770ec51a8317214ac5b3725fb827c5b98e86 (diff) | |
| download | go-6808da0163a353f7c4d871a215417e0da4db71f8.tar.xz | |
runtime: lock the main goroutine to the main OS thread during init
We only guarantee that the main goroutine runs on the
main OS thread for initialization. Programs that wish to
preserve that property for main.main can call runtime.LockOSThread.
This is what programs used to do before we unleashed
goroutines during init, so it is both a simple fix and keeps
existing programs working.
R=iant, r, dave, dvyukov
CC=golang-dev
https://golang.org/cl/5309070
Diffstat (limited to 'src/pkg/runtime/amd64')
| -rw-r--r-- | src/pkg/runtime/amd64/asm.s | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/pkg/runtime/amd64/asm.s b/src/pkg/runtime/amd64/asm.s index f34ce4a883..866e083106 100644 --- a/src/pkg/runtime/amd64/asm.s +++ b/src/pkg/runtime/amd64/asm.s @@ -60,7 +60,7 @@ ok: CALL runtime·schedinit(SB) // create a new goroutine to start program - PUSHQ $runtime·mainstart(SB) // entry + PUSHQ $runtime·main(SB) // entry PUSHQ $0 // arg size CALL runtime·newproc(SB) POPQ AX @@ -72,15 +72,6 @@ ok: CALL runtime·notok(SB) // never returns RET -TEXT runtime·mainstart(SB),7,$0 - CALL main·init(SB) - CALL main·main(SB) - PUSHQ $0 - CALL runtime·exit(SB) - POPQ AX - CALL runtime·notok(SB) - RET - TEXT runtime·breakpoint(SB),7,$0 BYTE $0xcc RET |
