You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
819 B
38 lines
819 B
5 years ago
|
#if NET20 || NET30 || !NET_4_6
|
||
|
|
||
|
namespace System.Threading
|
||
|
{
|
||
|
internal static class ReaderWriterLockSlimExtensions
|
||
|
{
|
||
|
internal static bool Has(this LockState state, LockState value)
|
||
|
{
|
||
|
return (state & value) > 0;
|
||
|
}
|
||
|
|
||
|
internal static bool IsSet(this ManualResetEventSlim self)
|
||
|
{
|
||
|
return self.IsSet;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
[Flags]
|
||
|
internal enum LockState
|
||
|
{
|
||
|
None = 0,
|
||
|
Upgradable = 1,
|
||
|
Read = 2,
|
||
|
Write = 4,
|
||
|
UpgradedRead = Upgradable | Read,
|
||
|
UpgradedWrite = Upgradable | Write
|
||
|
}
|
||
|
|
||
|
internal class ThreadLockState
|
||
|
{
|
||
|
public LockState LockState;
|
||
|
public int ReaderRecursiveCount;
|
||
|
public int UpgradeableRecursiveCount;
|
||
|
public int WriterRecursiveCount;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endif
|