add code comment

This commit is contained in:
kim 2024-11-05 14:40:56 +00:00
commit 0c84a2a5c6

View file

@ -30,11 +30,17 @@ import (
"github.com/tetratelabs/wazero"
)
// ffmpreg is a concurrency-safe pointer
// to our necessary WebAssembly runtime
// and compiled ffmpreg module instance.
var ffmpreg atomic.Pointer[struct {
run wazero.Runtime
mod wazero.CompiledModule
}]
// initWASM safely prepares new WebAssembly runtime
// and compiles ffmpreg module instance, if the global
// pointer has not been already. else, is a no-op.
func initWASM(ctx context.Context) error {
if ffmpreg.Load() != nil {
return nil