Skip to content

Commit

Permalink
doc: adds comments on simultaneous compilation
Browse files Browse the repository at this point in the history
Signed-off-by: Takeshi Yoneda <[email protected]>
  • Loading branch information
mathetake committed Aug 1, 2024
1 parent 22b92a5 commit d43d571
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ import (
// All implementations are in wazero.
// - Instances of this can be reused across multiple runtimes, if configured
// via RuntimeConfig.
// - The cache check happens before the compilation, so if multiple Goroutines are
// trying to compile the same module simultaneously, it is possible that they
// all compile the module. The design here is that the lock isn't held for the action "Compile"
// but only for saving the result. Therefore, we strongly recommend that the embedder
// does the centralized compilation in a single goroutine to generate cache rather than
// trying to Compile in parallel for a single module.
type CompilationCache interface{ api.Closer }

// NewCompilationCache returns a new CompilationCache to be passed to RuntimeConfig.
Expand Down

0 comments on commit d43d571

Please sign in to comment.