diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-23 11:06:19 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-23 11:07:16 +0900 |
| commit | 1b3902df7814e0f5e19d88acdc4588f6da1c895f (patch) | |
| tree | 8bcdf48a8620543116c12793ead576d0e20a3abf /container/dispatcher.go | |
| parent | ea1e3ebae993a3d89302940dc1649b627c420aa1 (diff) | |
container/dispatcher: instrument each goroutine individually
Scheduler nondeterminism cannot be accounted for, so do this instead.
There should not be any performance penalty as these calls are optimised out for direct.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/dispatcher.go')
| -rw-r--r-- | container/dispatcher.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/container/dispatcher.go b/container/dispatcher.go index 78648a7f..c7a8bad2 100644 --- a/container/dispatcher.go +++ b/container/dispatcher.go @@ -22,6 +22,11 @@ type osFile interface { // syscallDispatcher provides methods that make state-dependent system calls as part of their behaviour. type syscallDispatcher interface { + // new returns a new instance of syscallDispatcher for use in another goroutine. + // A syscallDispatcher must never be used in any goroutine other than the one owning it, + // just synchronising access is not enough, as this is for test instrumentation. + new() syscallDispatcher + // lockOSThread provides [runtime.LockOSThread]. lockOSThread() @@ -140,6 +145,8 @@ type syscallDispatcher interface { // direct implements syscallDispatcher on the current kernel. type direct struct{} +func (k direct) new() syscallDispatcher { return k } + func (direct) lockOSThread() { runtime.LockOSThread() } func (direct) setPtracer(pid uintptr) error { return SetPtracer(pid) } |
