mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
removed FastResourceLock.cs
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@1732 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
@@ -71,7 +71,6 @@
|
||||
<Compile Include="Logging.cs" />
|
||||
<Compile Include="Messaging\MessageQueue.cs" />
|
||||
<Compile Include="Threading\FastQueue.cs" />
|
||||
<Compile Include="Threading\FastResourceLock.cs" />
|
||||
<Compile Include="Threading\RundownProtection.cs" />
|
||||
<Compile Include="Threading\SemaphorePair.cs" />
|
||||
<Compile Include="Threading\SpinLock.cs" />
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ProcessHacker.Common.Threading
|
||||
{
|
||||
public unsafe class FastResourceLock
|
||||
{
|
||||
// Indicates that the lock is held.
|
||||
private const int _locked = 0x1;
|
||||
// Indicates that there are chained waiters.
|
||||
private const int _waiters = 0x2;
|
||||
// Flags mask.
|
||||
private const int _flags = 0x3;
|
||||
|
||||
private int _spinCount;
|
||||
private void* _value;
|
||||
|
||||
public struct FastResourceLockContext : IDisposable
|
||||
{
|
||||
private bool _disposed;
|
||||
private FastResourceLock _lock;
|
||||
private bool _shared;
|
||||
|
||||
internal FastResourceLockContext(FastResourceLock loc, bool shared)
|
||||
{
|
||||
_disposed = false;
|
||||
_lock = loc;
|
||||
_shared = shared;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
if (_shared)
|
||||
_lock.ReleaseShared();
|
||||
else
|
||||
_lock.ReleaseExclusive();
|
||||
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct FastResourceWaitBlock
|
||||
{
|
||||
public FastResourceWaitBlock* Previous;
|
||||
public FastResourceWaitBlock* Next;
|
||||
public FastResourceWaitBlock* Last;
|
||||
|
||||
public int SharedCount;
|
||||
|
||||
public IntPtr WakeEventHandle;
|
||||
}
|
||||
|
||||
public FastResourceLock()
|
||||
{
|
||||
_value = null;
|
||||
|
||||
if (Environment.ProcessorCount == 1)
|
||||
_spinCount = 0;
|
||||
else
|
||||
_spinCount = 1024;
|
||||
}
|
||||
|
||||
public void AcquireExclusive()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public FastResourceLockContext AcquireExclusiveContext()
|
||||
{
|
||||
this.AcquireExclusive();
|
||||
return new FastResourceLockContext(this, false);
|
||||
}
|
||||
|
||||
public void AcquireShared()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public FastResourceLockContext AcquireSharedContext()
|
||||
{
|
||||
this.AcquireShared();
|
||||
return new FastResourceLockContext(this, true);
|
||||
}
|
||||
|
||||
public void ReleaseExclusive()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ReleaseShared()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user