mirror of
https://github.com/apple/container.git
synced 2026-09-22 15:45:38 +00:00
Use a lock consistently in the ExecutionContext class (#619)
The changes in this PR improve the consistency of using a lock in the `ExecutionContext` class.
This commit is contained in:
@@ -175,17 +175,19 @@ public final class ExecutionContext: @unchecked Sendable {
|
||||
|
||||
/// Create a child context for a nested execution.
|
||||
public func childContext(for stage: BuildStage) -> ExecutionContext {
|
||||
lock.withLock {
|
||||
ExecutionContext(
|
||||
stage: stage,
|
||||
graph: graph,
|
||||
platform: platform,
|
||||
reporter: reporter,
|
||||
snapshotter: snapshotter,
|
||||
baseEnvironment: Environment(_environment.variables),
|
||||
baseConfig: _imageConfig
|
||||
)
|
||||
let (environmentVars, imageConfig) = lock.withLock {
|
||||
(_environment.variables, _imageConfig)
|
||||
}
|
||||
|
||||
return ExecutionContext(
|
||||
stage: stage,
|
||||
graph: graph,
|
||||
platform: platform,
|
||||
reporter: reporter,
|
||||
snapshotter: snapshotter,
|
||||
baseEnvironment: Environment(environmentVars),
|
||||
baseConfig: imageConfig
|
||||
)
|
||||
}
|
||||
|
||||
// MARK: - Snapshotter Integration
|
||||
|
||||
Reference in New Issue
Block a user