aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/dispatcher.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-08-23 21:47:06 +0900
committerOphestra <cat@gensokyo.uk>2025-08-23 21:58:40 +0900
commit0166833431633f7acc8b0d35c4451494eff8710a (patch)
tree7af41193d37499dc375394d0f78038d8abf5a7f8 /container/dispatcher.go
parentb3da3da525e066c67a14503a3a0d00d5024cc62d (diff)
container/dispatcher: start goroutine in dispatcher
This allows instrumentation of calls from goroutine without relying on finalizers. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/dispatcher.go')
-rw-r--r--container/dispatcher.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/container/dispatcher.go b/container/dispatcher.go
index c7a8bad2..ae697cef 100644
--- a/container/dispatcher.go
+++ b/container/dispatcher.go
@@ -22,10 +22,10 @@ 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.
+ // new starts a goroutine with a new instance of syscallDispatcher.
// 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
+ new(f func(k syscallDispatcher))
// lockOSThread provides [runtime.LockOSThread].
lockOSThread()
@@ -145,7 +145,7 @@ type syscallDispatcher interface {
// direct implements syscallDispatcher on the current kernel.
type direct struct{}
-func (k direct) new() syscallDispatcher { return k }
+func (k direct) new(f func(k syscallDispatcher)) { go f(k) }
func (direct) lockOSThread() { runtime.LockOSThread() }