@@ -261,34 +261,34 @@ public Task<long> GetExitCodeAsync(CancellationToken ct = default)
261
261
/// <inheritdoc />
262
262
public virtual async Task StartAsync ( CancellationToken ct = default )
263
263
{
264
- using ( _ = AcquireLock ( ) )
265
- {
266
- var futureResources = Array . Empty < IFutureResource > ( )
267
- . Concat ( _configuration . Mounts )
268
- . Concat ( _configuration . Networks ) ;
264
+ using var disposable = await AcquireLockAsync ( ct )
265
+ . ConfigureAwait ( false ) ;
269
266
270
- await Task . WhenAll ( futureResources . Select ( resource => resource . CreateAsync ( ct ) ) )
271
- . ConfigureAwait ( false ) ;
267
+ var futureResources = Array . Empty < IFutureResource > ( )
268
+ . Concat ( _configuration . Mounts )
269
+ . Concat ( _configuration . Networks ) ;
272
270
273
- await Task . WhenAll ( _configuration . Containers . Select ( resource => resource . StartAsync ( ct ) ) )
274
- . ConfigureAwait ( false ) ;
271
+ await Task . WhenAll ( futureResources . Select ( resource => resource . CreateAsync ( ct ) ) )
272
+ . ConfigureAwait ( false ) ;
275
273
276
- await UnsafeCreateAsync ( ct )
277
- . ConfigureAwait ( false ) ;
274
+ await Task . WhenAll ( _configuration . Containers . Select ( resource => resource . StartAsync ( ct ) ) )
275
+ . ConfigureAwait ( false ) ;
278
276
279
- await UnsafeStartAsync ( ct )
280
- . ConfigureAwait ( false ) ;
281
- }
277
+ await UnsafeCreateAsync ( ct )
278
+ . ConfigureAwait ( false ) ;
279
+
280
+ await UnsafeStartAsync ( ct )
281
+ . ConfigureAwait ( false ) ;
282
282
}
283
283
284
284
/// <inheritdoc />
285
285
public virtual async Task StopAsync ( CancellationToken ct = default )
286
286
{
287
- using ( _ = AcquireLock ( ) )
288
- {
289
- await UnsafeStopAsync ( ct )
290
- . ConfigureAwait ( false ) ;
291
- }
287
+ using var disposable = await AcquireLockAsync ( ct )
288
+ . ConfigureAwait ( false ) ;
289
+
290
+ await UnsafeStopAsync ( ct )
291
+ . ConfigureAwait ( false ) ;
292
292
}
293
293
294
294
/// <inheritdoc />
@@ -344,7 +344,8 @@ protected override async ValueTask DisposeAsyncCore()
344
344
return ;
345
345
}
346
346
347
- using ( _ = AcquireLock ( ) )
347
+ using ( _ = await AcquireLockAsync ( )
348
+ . ConfigureAwait ( false ) )
348
349
{
349
350
if ( Guid . Empty . Equals ( _configuration . SessionId ) )
350
351
{
0 commit comments