-
Notifications
You must be signed in to change notification settings - Fork 754
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Norbert Žofák <[email protected]>
- Loading branch information
1 parent
6250dae
commit 8b7eb2e
Showing
93 changed files
with
2,232 additions
and
1,816 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
Plugins/TechTalk.SpecFlow.xUnit.SpecFlowPlugin/XUnitParallelWorkerTracker.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Concurrent; | ||
using System.Threading; | ||
|
||
namespace TechTalk.SpecFlow.xUnit.SpecFlowPlugin; | ||
|
||
public class XUnitParallelWorkerTracker | ||
{ | ||
public static readonly XUnitParallelWorkerTracker Instance = new(); | ||
|
||
private readonly ConcurrentBag<string> _availableWorkers = new(); | ||
private int _workerCount = 0; | ||
|
||
private XUnitParallelWorkerTracker() { } | ||
|
||
public string GetWorkerId() | ||
{ | ||
if (!_availableWorkers.TryTake(out var workerId)) | ||
{ | ||
workerId = $"XW{Interlocked.Increment(ref _workerCount):D3}"; | ||
} | ||
return workerId; | ||
} | ||
|
||
public void ReleaseWorker(string workerId) | ||
{ | ||
_availableWorkers.Add(workerId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.