File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,25 @@ func UnlockOSThread() {
106
106
// point of the call.
107
107
func KeepAlive (x interface {})
108
108
109
+ // AddCleanup is a dummy cleanup implementation. It doesn't do any cleaning up.
110
+ //
111
+ // We base this on the following loophole in the official runtime.AddCleanup
112
+ // documentation:
113
+ //
114
+ // > The cleanup(arg) call is not always guaranteed to run; in particular it is
115
+ // > not guaranteed to run before program exit.
116
+ //
117
+ // So it's technically correct (the best kind of correct) to not run any
118
+ // cleanups. But of course, this can lead to resource leaks so cleanups may need
119
+ // to be implemented eventually.
120
+ func AddCleanup [T , S any ](ptr * T , cleanup func (S ), arg S ) Cleanup {
121
+ return Cleanup {}
122
+ }
123
+
124
+ type Cleanup struct {}
125
+
126
+ func (c Cleanup ) Stop () {}
127
+
109
128
var godebugUpdate func (string , string )
110
129
111
130
//go:linkname godebug_setUpdate internal/godebug.setUpdate
You can’t perform that action at this time.
0 commit comments