mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
full diff: https://github.com/tetratelabs/wazero/compare/v0.9.0...v1.10.1 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
20 lines
585 B
Go
20 lines
585 B
Go
package experimental
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/tetratelabs/wazero/internal/expctxkeys"
|
|
)
|
|
|
|
// WithCompilationWorkers sets the desired number of compilation workers.
|
|
func WithCompilationWorkers(ctx context.Context, workers int) context.Context {
|
|
return context.WithValue(ctx, expctxkeys.CompilationWorkers{}, workers)
|
|
}
|
|
|
|
// GetCompilationWorkers returns the desired number of compilation workers.
|
|
// The minimum value returned is 1.
|
|
func GetCompilationWorkers(ctx context.Context) int {
|
|
workers, _ := ctx.Value(expctxkeys.CompilationWorkers{}).(int)
|
|
return max(workers, 1)
|
|
}
|