Skip to content

Commit 1064127

Browse files
committed
Mutex
1 parent 0e882ed commit 1064127

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

scripts/matrix_testing/CreateMatrixTestReport.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,11 @@ $jobRows = $queriesToCheck | ForEach-Object -ThrottleLimit $NumThreads -Parallel
299299

300300
foreach($testDirectory in $testDirs){
301301

302+
Write-Host "Aquiring lock for $testDirectory"
303+
$Mutex = New-Object -TypeName System.Threading.Mutex -ArgumentList $false, ("__Matrix_" + $testDirectory.Replace("\","_"));
304+
$Mutex.WaitOne() | Out-Null;
305+
Write-Host "Locked $testDirectory"
306+
302307
# for the report
303308
$row = @{
304309
"SUITE" = $CurrentSuiteName;
@@ -412,6 +417,8 @@ $jobRows = $queriesToCheck | ForEach-Object -ThrottleLimit $NumThreads -Parallel
412417
# output current row state
413418
$row
414419

420+
# release any held mutexes
421+
$Mutex.ReleaseMutex();
415422

416423
###########################################################
417424
###########################################################
@@ -423,6 +430,8 @@ $jobRows = $queriesToCheck | ForEach-Object -ThrottleLimit $NumThreads -Parallel
423430
}
424431
}
425432
# go to next row
433+
434+
426435
}
427436

428437
# combine the outputs

0 commit comments

Comments
 (0)