// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
+using System.Threading;
namespace System.Security
{
{
get
{
- lock (_methodLock)
- {
- EnsureNotDisposed();
- return _decryptedLength;
- }
+ EnsureNotDisposed();
+ return Volatile.Read(ref _decryptedLength);
}
}
public bool IsReadOnly()
{
- lock (_methodLock)
- {
- EnsureNotDisposed();
- return _readOnly;
- }
+ EnsureNotDisposed();
+ return Volatile.Read(ref _readOnly);
}
public void MakeReadOnly()
{
- lock (_methodLock)
- {
- EnsureNotDisposed();
- _readOnly = true;
- }
+ EnsureNotDisposed();
+ Volatile.Write(ref _readOnly, true);
}
public void RemoveAt(int index)