Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions GVFS/GVFS.Common/Database/PlaceholderTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Threading;

namespace GVFS.Common.Database
{
/// <summary>
/// This class is for interacting with the Placeholder table in the SQLite database
/// This class is for interacting with the Placeholder tablein the SQLite database
/// </summary>
public class PlaceholderTable : IPlaceholderCollection
{
private IGVFSConnectionPool connectionPool;
private object writerLock = new object();
private Lock writerLock = new Lock();

public PlaceholderTable(IGVFSConnectionPool connectionPool)
{
Expand Down
3 changes: 2 additions & 1 deletion GVFS/GVFS.Common/Database/SparseTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Threading;

namespace GVFS.Common.Database
{
public class SparseTable : ISparseCollection
{
private IGVFSConnectionPool connectionPool;
private object writerLock = new object();
private Lock writerLock = new Lock();

public SparseTable(IGVFSConnectionPool connectionPool)
{
Expand Down
2 changes: 1 addition & 1 deletion GVFS/GVFS.Common/FileBasedCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public abstract class FileBasedCollection : IDisposable
/// </summary>
private readonly bool collectionAppendsDirectlyToFile;

private readonly object fileLock = new object();
private readonly Lock fileLock = new Lock();

private readonly PhysicalFileSystem fileSystem;
private readonly string dataDirectoryPath;
Expand Down
2 changes: 1 addition & 1 deletion GVFS/GVFS.Common/GVFSLock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace GVFS.Common
{
public partial class GVFSLock
{
private readonly object acquisitionLock = new object();
private readonly Lock acquisitionLock = new Lock();
private readonly ITracer tracer;
private readonly LockHolder currentLockHolder = new LockHolder();

Expand Down
3 changes: 2 additions & 1 deletion GVFS/GVFS.Common/Git/GitAuthentication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
using System.Net.Http;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;

namespace GVFS.Common.Git
{
public class GitAuthentication
{
private const double MaxBackoffSeconds = 30;

private readonly object gitAuthLock = new object();
private readonly Lock gitAuthLock = new Lock();
private readonly ICredentialStore credentialStore;
private readonly string repoUrl;

Expand Down
5 changes: 3 additions & 2 deletions GVFS/GVFS.Common/Git/GitProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

namespace GVFS.Common.Git
{
Expand All @@ -21,14 +22,14 @@ public class GitProcess : ICredentialStore
/// <summary>
/// Lock taken for duration of running executingProcess.
/// </summary>
private object executionLock = new object();
private Lock executionLock = new Lock();

/// <summary>
/// Lock taken when changing the running state of executingProcess.
///
/// Can be taken within executionLock.
/// </summary>
private object processLock = new object();
private Lock processLock = new Lock();

private string gitBinPath;
private string workingDirectoryRoot;
Expand Down
2 changes: 1 addition & 1 deletion GVFS/GVFS.Common/Git/LibGit2RepoInvoker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class LibGit2RepoInvoker : IDisposable
{
private readonly Func<LibGit2Repo> createRepo;
private readonly ITracer tracer;
private readonly object sharedRepoLock = new object();
private readonly Lock sharedRepoLock = new Lock();
private volatile bool disposing;
private volatile int activeCallers;
private LibGit2Repo sharedRepo;
Expand Down
6 changes: 3 additions & 3 deletions GVFS/GVFS.Common/GitStatusCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class GitStatusCache : IDisposable

private volatile CacheState cacheState = CacheState.Dirty;

private object cacheFileLock = new object();
private Lock cacheFileLock = new Lock();

internal static bool? TEST_EnableHydrationSummaryOverride = null;

Expand Down Expand Up @@ -597,7 +597,7 @@ private bool TryRebuildStatusCache()

private bool TryDeleteStatusCacheFile()
{
Debug.Assert(Monitor.IsEntered(this.cacheFileLock), "Attempting to delete the git status cache file without the cacheFileLock");
Debug.Assert(this.cacheFileLock.IsHeldByCurrentThread, "Attempting to delete the git status cache file without the cacheFileLock");

try
{
Expand Down Expand Up @@ -635,7 +635,7 @@ private bool TryDeleteStatusCacheFile()
/// <returns>True on success, False on failure</returns>
private bool MoveCacheFileToFinalLocation(string tmpStatusFilePath)
{
Debug.Assert(Monitor.IsEntered(this.cacheFileLock), "Attempting to update the git status cache file without the cacheFileLock");
Debug.Assert(this.cacheFileLock.IsHeldByCurrentThread, "Attempting to update the git status cache file without the cacheFileLock");

try
{
Expand Down
2 changes: 1 addition & 1 deletion GVFS/GVFS.Common/Maintenance/GitMaintenanceQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace GVFS.Common.Maintenance
{
public class GitMaintenanceQueue
{
private readonly object queueLock = new object();
private readonly Lock queueLock = new Lock();
private GVFSContext context;
private BlockingCollection<GitMaintenanceStep> queue = new BlockingCollection<GitMaintenanceStep>();
private GitMaintenanceStep currentStep;
Expand Down
3 changes: 2 additions & 1 deletion GVFS/GVFS.Common/Maintenance/GitMaintenanceStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;

namespace GVFS.Common.Maintenance
{
public abstract class GitMaintenanceStep
{
public const string ObjectCacheLock = "git-maintenance-step.lock";
private readonly object gitProcessLock = new object();
private readonly Lock gitProcessLock = new Lock();

public GitMaintenanceStep(GVFSContext context, bool requireObjectCacheLock, GitProcessChecker gitProcessChecker = null)
{
Expand Down
3 changes: 2 additions & 1 deletion GVFS/GVFS.Common/MissingTreeTracker.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using GVFS.Common.Tracing;

namespace GVFS.Common
Expand All @@ -16,7 +17,7 @@ public class MissingTreeTracker

private readonly int treeCapacity;
private readonly ITracer tracer;
private readonly object syncLock = new object();
private readonly Lock syncLock = new Lock();

// Primary storage: commit -> set of missing trees
private readonly Dictionary<string, HashSet<string>> missingTreesByCommit;
Expand Down
3 changes: 2 additions & 1 deletion GVFS/GVFS.Common/Tracing/PrettyConsoleEventListener.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Threading;

namespace GVFS.Common.Tracing
{
Expand All @@ -9,7 +10,7 @@ namespace GVFS.Common.Tracing
/// </summary>
public class PrettyConsoleEventListener : EventListener
{
private static object consoleLock = new object();
private static Lock consoleLock = new Lock();

public PrettyConsoleEventListener(EventLevel maxVerbosity, Keywords keywordFilter, IEventListenerEventSink eventSink)
: base(maxVerbosity, keywordFilter, eventSink)
Expand Down
3 changes: 2 additions & 1 deletion GVFS/GVFS.Platform.Windows/WindowsFileBasedLock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.ComponentModel;
using System.IO;
using System.Text;
using System.Threading;

namespace GVFS.Platform.Windows
{
Expand All @@ -16,7 +17,7 @@ public class WindowsFileBasedLock : FileBasedLock
private const string EtwArea = nameof(WindowsFileBasedLock);
private static readonly Encoding UTF8NoBOM = new UTF8Encoding(false, true); // Default encoding used by StreamWriter

private readonly object deleteOnCloseStreamLock = new object();
private readonly Lock deleteOnCloseStreamLock = new Lock();
private Stream deleteOnCloseStream;

/// <summary>
Expand Down
3 changes: 2 additions & 1 deletion GVFS/GVFS.Service/Handlers/EnableAndAttachProjFSHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
using GVFS.Common.NamedPipes;
using GVFS.Common.Tracing;
using GVFS.Platform.Windows;
using System.Threading;

namespace GVFS.Service.Handlers
{
public class EnableAndAttachProjFSHandler : MessageHandler
{
private const string EtwArea = nameof(EnableAndAttachProjFSHandler);

private static object enablePrjFltLock = new object();
private static Lock enablePrjFltLock = new Lock();

private NamedPipeServer.Connection connection;
private NamedPipeMessages.EnableAndAttachProjFSRequest request;
Expand Down
2 changes: 1 addition & 1 deletion GVFS/GVFS.Service/Handlers/RequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class RequestHandler
private ITracer tracer;
private IRepoRegistry repoRegistry;
private Timer pendingUpgradeTimer;
private readonly object pendingUpgradeTimerLock = new object();
private readonly Lock pendingUpgradeTimerLock = new Lock();

public RequestHandler(ITracer tracer, string etwArea, IRepoRegistry repoRegistry)
{
Expand Down
2 changes: 1 addition & 1 deletion GVFS/GVFS.Service/PendingUpgradeHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static class PendingUpgradeHandler
private const string MountProcessName = "GVFS.Mount";
private const string MountExeName = "GVFS.Mount.exe";

private static readonly object ApplyLock = new object();
private static readonly Lock ApplyLock = new Lock();

// Executables that users or the service can launch to start new
// mount/hook processes. During upgrade these are moved out first
Expand Down
2 changes: 1 addition & 1 deletion GVFS/GVFS.Service/PendingUpgradeMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public sealed class PendingUpgradeMonitor : IDisposable
private const int DebouncePeriodMs = 1000;

private readonly ITracer tracer;
private readonly object syncLock = new object();
private readonly Lock syncLock = new Lock();
private List<Process> trackedProcesses = new List<Process>();
private Timer debounceTimer;
private bool disposed;
Expand Down
3 changes: 2 additions & 1 deletion GVFS/GVFS.Service/RepoRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;

namespace GVFS.Service
{
Expand All @@ -20,7 +21,7 @@ public class RepoRegistry : IRepoRegistry
private string registryParentFolderPath;
private ITracer tracer;
private PhysicalFileSystem fileSystem;
private object repoLock = new object();
private Lock repoLock = new Lock();
private IRepoMounter repoMounter;
private INotificationHandler notificationHandler;

Expand Down
2 changes: 1 addition & 1 deletion GVFS/GVFS.UnitTests/Tracing/QueuedPipeStringWriterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private class TestPipeReaderWorker : IDisposable

private int bufferLength = 0;
private byte[] buffer = new byte[16*1024];
private object bufferLock = new object();
private Lock bufferLock = new Lock();
private Thread thread;
private bool isRunning;
private bool isDisposed;
Expand Down
Loading