diff options
| author | Alex Brainman <alex.brainman@gmail.com> | 2012-05-30 15:10:54 +1000 |
|---|---|---|
| committer | Alex Brainman <alex.brainman@gmail.com> | 2012-05-30 15:10:54 +1000 |
| commit | afe0e97aa65be9dd0c147c4c824c12b1442ef2df (patch) | |
| tree | f2bccdc246723dec86fea5e31ceb622e5fcb61b1 /src/pkg/runtime/proc.c | |
| parent | 034fa90dc113994cbbc4e31ae6a2f7c9d06ed1eb (diff) | |
| download | go-afe0e97aa65be9dd0c147c4c824c12b1442ef2df.tar.xz | |
runtime: handle windows exceptions, even in cgo programs
Fixes #3543.
R=golang-dev, kardianos, rsc
CC=golang-dev, hectorchu, vcc.163
https://golang.org/cl/6245063
Diffstat (limited to 'src/pkg/runtime/proc.c')
| -rw-r--r-- | src/pkg/runtime/proc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index 81decd6bf8..fbc262904b 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -758,6 +758,11 @@ runtime·starttheworld(void) void runtime·mstart(void) { + // It is used by windows-386 only. Unfortunately, seh needs + // to be located on os stack, and mstart runs on os stack + // for both m0 and m. + SEH seh; + if(g != m->g0) runtime·throw("bad runtime·mstart"); @@ -766,6 +771,7 @@ runtime·mstart(void) // so other calls can reuse this stack space. runtime·gosave(&m->g0->sched); m->g0->sched.pc = (void*)-1; // make sure it is never used + m->seh = &seh; runtime·asminit(); runtime·minit(); @@ -775,6 +781,10 @@ runtime·mstart(void) runtime·initsig(); schedule(nil); + + // TODO(brainman): This point is never reached, because scheduler + // does not release os threads at the moment. But once this path + // is enabled, we must remove our seh here. } // When running with cgo, we call libcgo_thread_start |
