mirror of
https://codeberg.org/superseriousbusiness/gotosocial.git
synced 2024-12-21 16:34:26 +03:00
22 lines
383 B
Go
22 lines
383 B
Go
|
package util
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"github.com/tetratelabs/wazero/experimental"
|
||
|
)
|
||
|
|
||
|
type moduleKey struct{}
|
||
|
type moduleState struct {
|
||
|
mmapState
|
||
|
handleState
|
||
|
}
|
||
|
|
||
|
func NewContext(ctx context.Context) context.Context {
|
||
|
state := new(moduleState)
|
||
|
ctx = withAllocator(ctx)
|
||
|
ctx = experimental.WithCloseNotifier(ctx, state)
|
||
|
ctx = context.WithValue(ctx, moduleKey{}, state)
|
||
|
return ctx
|
||
|
}
|