diff options
author | Russ Cox <rsc@golang.org> | 2009-07-13 17:28:39 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-07-13 17:28:39 -0700 |
commit | 81d09f0683297aec12e8c6de9c670fd092a95bde (patch) | |
tree | 1f8296c92fdb3c4c5c200b360ca1603565e8cc5a /src/pkg/runtime/extern.go | |
parent | 91aa93c44cf7fd18f289a594a5057281586919a9 (diff) | |
download | golang-81d09f0683297aec12e8c6de9c670fd092a95bde.tar.gz |
add LockOSThread and UnlockOSThread to
runtime package for use by debugger,
which needs to make sure that all ptrace calls
about a given pid come from the same thread.
R=r
DELTA=175 (90 added, 63 deleted, 22 changed)
OCL=31546
CL=31558
Diffstat (limited to 'src/pkg/runtime/extern.go')
-rw-r--r-- | src/pkg/runtime/extern.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pkg/runtime/extern.go b/src/pkg/runtime/extern.go index 6fb5756d6..1f6561394 100644 --- a/src/pkg/runtime/extern.go +++ b/src/pkg/runtime/extern.go @@ -26,3 +26,17 @@ func Breakpoint() // program counter, file name, and line number within the file of the corresponding // call. The boolean ok is false if it was not possible to recover the information. func Caller(n int) (pc uintptr, file string, line int, ok bool) + +// mid returns the current os thread (m) id. +func mid() uint32 + +// LockOSThread wires the calling goroutine to its current operating system thread. +// Until the calling goroutine exits or calls UnlockOSThread, it will always +// execute in that thread, and no other goroutine can. +// LockOSThread cannot be used during init functions. +func LockOSThread() + +// UnlockOSThread unwires the calling goroutine from its fixed operating system thread. +// If the calling goroutine has not called LockOSThread, UnlockOSThread is a no-op. +func UnlockOSThread() + |