diff options
| author | Russ Cox <rsc@golang.org> | 2013-02-01 08:34:41 -0800 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2013-02-01 08:34:41 -0800 |
| commit | b0a29f393b5672c37355eb7a5f126cc0e1537834 (patch) | |
| tree | 5c511861b88be5b7eecb026ac3cb9e7062953043 /src/pkg/runtime/runtime.h | |
| parent | 32a6097fdea70f64e56a03709befe3adc3c70038 (diff) | |
| download | go-b0a29f393b5672c37355eb7a5f126cc0e1537834.tar.xz | |
runtime: cgo-related fixes
* Separate internal and external LockOSThread, for cgo safety.
* Show goroutine that made faulting cgo call.
* Never start a panic due to a signal caused by a cgo call.
Fixes #3774.
Fixes #3775.
Fixes #3797.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7228081
Diffstat (limited to 'src/pkg/runtime/runtime.h')
| -rw-r--r-- | src/pkg/runtime/runtime.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h index 3e99b75bea..ea46388d71 100644 --- a/src/pkg/runtime/runtime.h +++ b/src/pkg/runtime/runtime.h @@ -281,6 +281,7 @@ struct M uint32 freglo[16]; // D[i] lsb and F[i] uint32 freghi[16]; // D[i] msb and F[i+16] uint32 fflag; // floating point compare flags + uint32 locked; // tracking for LockOSThread M* nextwaitm; // next M waiting for lock uintptr waitsema; // semaphore for parking on locks uint32 waitsemacount; @@ -303,6 +304,15 @@ struct M uintptr end[]; }; +// The m->locked word holds a single bit saying whether +// external calls to LockOSThread are in effect, and then a counter +// of the internal nesting depth of lockOSThread / unlockOSThread. +enum +{ + LockExternal = 1, + LockInternal = 2, +}; + struct Stktop { // The offsets of these fields are known to (hard-coded in) libmach. @@ -858,8 +868,8 @@ void runtime·semrelease(uint32*); int32 runtime·gomaxprocsfunc(int32 n); void runtime·procyield(uint32); void runtime·osyield(void); -void runtime·LockOSThread(void); -void runtime·UnlockOSThread(void); +void runtime·lockOSThread(void); +void runtime·unlockOSThread(void); void runtime·mapassign(MapType*, Hmap*, byte*, byte*); void runtime·mapaccess(MapType*, Hmap*, byte*, byte*, bool*); |
