mirror of
https://github.com/github/codeql.git
synced 2026-04-24 08:15:14 +02:00
Simplify task counter incrementing
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
@@ -23,8 +24,6 @@ namespace Semmle.Extraction.CSharp
|
||||
private protected Entities.Compilation? compilationEntity;
|
||||
private IDisposable? compilationTrapFile;
|
||||
|
||||
private readonly object progressMutex = new object();
|
||||
|
||||
// The bulk of the extraction work, potentially executed in parallel.
|
||||
protected readonly List<Action> extractionTasks = new List<Action>();
|
||||
private int taskCount = 0;
|
||||
@@ -242,8 +241,6 @@ namespace Semmle.Extraction.CSharp
|
||||
try
|
||||
{
|
||||
var assemblyPath = extractor.OutputPath;
|
||||
|
||||
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
var currentTaskId = IncrementTaskCount();
|
||||
@@ -298,10 +295,7 @@ namespace Semmle.Extraction.CSharp
|
||||
|
||||
private int IncrementTaskCount()
|
||||
{
|
||||
lock (progressMutex)
|
||||
{
|
||||
return ++taskCount;
|
||||
}
|
||||
return Interlocked.Increment(ref taskCount);
|
||||
}
|
||||
|
||||
private void ReportProgressTaskStarted(int currentCount, string src)
|
||||
|
||||
Reference in New Issue
Block a user