MCPcopy Index your code
hub / github.com/yuin/gopher-lua / allocFinalizerUserData

Function allocFinalizerUserData

script_test.go:91–101  ·  view source on GitHub ↗
(L *LState)

Source from the content-addressed store, hash-verified

89type finalizerStub struct{ x byte }
90
91func allocFinalizerUserData(L *LState) int {
92 ud := L.NewUserData()
93 atomic.AddInt32(&numActiveUserDatas, 1)
94 a := finalizerStub{}
95 ud.Value = &a
96 runtime.SetFinalizer(&a, func(aa *finalizerStub) {
97 atomic.AddInt32(&numActiveUserDatas, -1)
98 })
99 L.Push(ud)
100 return 1
101}
102
103func sleep(L *LState) int {
104 time.Sleep(time.Duration(L.CheckInt(1)) * time.Millisecond)

Callers

nothing calls this directly

Calls 2

PushMethod · 0.65
NewUserDataMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…