MCPcopy Create free account
hub / github.com/devld/go-drive / Fork

Method Fork

script/runtime.go:72–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70}
71
72func (v *VM) Fork() *VM {
73 v.vmsMu.Lock()
74 defer v.vmsMu.Unlock()
75 newVM := &VM{
76 o: v.o.Copy(),
77 vms: v.vms,
78 vmsMu: v.vmsMu,
79 disposables: make(map[any]struct{}),
80 }
81 newVM.o.Interrupt = make(chan func(), 1)
82 v.vms[newVM.o] = newVM
83 return newVM
84}
85
86// resolveVM returns the *VM that owns the given otto runtime. Forks share a
87// single vms map, so reads must be guarded against concurrent Fork/Dispose

Callers 7

newSharedStateTestVMFunction · 0.95
NewVMPoolFunction · 0.80
GetMethod · 0.80
ExecuteJobCodeFunction · 0.80
createVmFunction · 0.80

Calls 3

LockMethod · 0.65
UnlockMethod · 0.65
CopyMethod · 0.65

Tested by 3

newSharedStateTestVMFunction · 0.76