Skip to content

Commit

Permalink
Delete HostProtection attributes (dotnet/coreclr#8610)
Browse files Browse the repository at this point in the history
Commit migrated from dotnet/coreclr@1cfbb8d
  • Loading branch information
jkotas committed Dec 13, 2016
1 parent 794feca commit f06e41a
Show file tree
Hide file tree
Showing 63 changed files with 0 additions and 136 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ private Thread AsThread()
public bool IsBackground
{
get { return IsBackgroundNative(); }
[HostProtection(SelfAffectingThreading = true)]
set { SetBackgroundNative(value); }
}

Expand Down Expand Up @@ -77,7 +76,6 @@ public bool IsBackground
public ThreadPriority Priority
{
get { return (ThreadPriority)GetPriorityNative(); }
[HostProtection(SelfAffectingThreading = true)]
set { SetPriorityNative((int)value); }
}

Expand Down Expand Up @@ -113,7 +111,6 @@ public ApartmentState GetApartmentState()
** An unstarted thread can be marked to indicate that it will host a
** single-threaded or multi-threaded apartment.
=========================================================================*/
[HostProtection(Synchronization = true, SelfAffectingThreading = true)]
public bool TrySetApartmentState(ApartmentState state)
{
#if FEATURE_COMINTEROP_APARTMENT_SUPPORT
Expand Down Expand Up @@ -184,10 +181,8 @@ public void DisableComObjectEagerCleanup()
** ThreadInterruptedException if the thread is interrupted while waiting.
** ThreadStateException if the thread has not been started yet.
=========================================================================*/
[HostProtection(Synchronization = true, ExternalThreading = true)]
public void Join() => JoinInternal(Timeout.Infinite);

[HostProtection(Synchronization = true, ExternalThreading = true)]
public bool Join(int millisecondsTimeout) => JoinInternal(millisecondsTimeout);

[MethodImpl(MethodImplOptions.InternalCall)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace Microsoft.Win32 {
using Microsoft.Win32.SafeHandles;
using System.Security.Permissions;

[HostProtectionAttribute(MayLeakOnAbort = true)]
sealed internal class SafeLibraryHandle : SafeHandleZeroOrMinusOneIsInvalid {
internal SafeLibraryHandle() : base(true) {}

Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/src/mscorlib/src/System/Collections/ArrayList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,6 @@ public virtual void Sort(IComparer comparer)

// Returns a thread-safe wrapper around an IList.
//
[HostProtection(Synchronization=true)]
public static IList Synchronized(IList list) {
if (list==null)
throw new ArgumentNullException(nameof(list));
Expand All @@ -736,7 +735,6 @@ public virtual void Sort(IComparer comparer)

// Returns a thread-safe wrapper around a ArrayList.
//
[HostProtection(Synchronization=true)]
public static ArrayList Synchronized(ArrayList list) {
if (list==null)
throw new ArgumentNullException(nameof(list));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ namespace System.Collections.Concurrent
[ComVisible(false)]
[DebuggerTypeProxy(typeof(Mscorlib_DictionaryDebugView<,>))]
[DebuggerDisplay("Count = {Count}")]
[HostProtection(Synchronization = true, ExternalThreading = true)]
public class ConcurrentDictionary<TKey, TValue> : IDictionary<TKey, TValue>, IDictionary, IReadOnlyDictionary<TKey, TValue>
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ namespace System.Collections.Concurrent
[ComVisible(false)]
[DebuggerDisplay("Count = {Count}")]
[DebuggerTypeProxy(typeof(SystemCollectionsConcurrent_ProducerConsumerCollectionDebugView<>))]
[HostProtection(Synchronization = true, ExternalThreading = true)]
[Serializable]
public class ConcurrentQueue<T> : IProducerConsumerCollection<T>, IReadOnlyCollection<T>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ namespace System.Collections.Concurrent
/// </remarks>
[DebuggerDisplay("Count = {Count}")]
[DebuggerTypeProxy(typeof(SystemCollectionsConcurrent_ProducerConsumerCollectionDebugView<>))]
[HostProtection(Synchronization = true, ExternalThreading = true)]
public class ConcurrentStack<T> : IProducerConsumerCollection<T>, IReadOnlyCollection<T>
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ namespace System.Collections.Concurrent
/// </ol>
/// </para>
/// </remarks>
[HostProtection(Synchronization = true, ExternalThreading = true)]
public abstract class OrderablePartitioner<TSource> : Partitioner<TSource>
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ namespace System.Collections.Concurrent
/// </ol>
/// </para>
/// </remarks>
[HostProtection(Synchronization = true, ExternalThreading = true)]
public abstract class Partitioner<TSource>
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public enum EnumerablePartitionerOptions
/// thread.
/// </para>
/// </remarks>
[HostProtection(Synchronization = true, ExternalThreading = true)]
public static class Partitioner
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,6 @@ private void putEntry (bucket[] newBuckets, Object key, Object nvalue, int hashc

// Returns a thread-safe wrapper for a Hashtable.
//
[HostProtection(Synchronization=true)]
public static Hashtable Synchronized(Hashtable table) {
if (table==null)
throw new ArgumentNullException(nameof(table));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,6 @@ public virtual Object Clone()

// Returns a thread-safe SortedList.
//
[HostProtection(Synchronization=true)]
public static SortedList Synchronized(SortedList list) {
if (list==null)
throw new ArgumentNullException(nameof(list));
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/src/mscorlib/src/System/Collections/Stack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ public Stack(ICollection col) : this((col==null ? 32 : col.Count))

// Returns a synchronized Stack.
//
[HostProtection(Synchronization=true)]
public static Stack Synchronized(Stack stack) {
if (stack==null)
throw new ArgumentNullException(nameof(stack));
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/src/mscorlib/src/System/Diagnostics/log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ namespace System.Diagnostics {
// programatically, by registry (specifics....) or environment
// variables.
[Serializable]
[HostProtection(Synchronization=true, ExternalThreading=true)]
internal delegate void LogMessageEventHandler(LoggingLevels level, LogSwitch category,
String message,
StackTrace location);
Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/src/mscorlib/src/System/IO/MemoryStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ protected override void Dispose(bool disposing)
public override void Flush() {
}

[HostProtection(ExternalThreading=true)]
[ComVisible(false)]
public override Task FlushAsync(CancellationToken cancellationToken) {

Expand Down Expand Up @@ -358,7 +357,6 @@ internal void InternalGetOriginAndLength(out int origin, out int length)
return n;
}

[HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public override Task<int> ReadAsync(Byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
Expand Down Expand Up @@ -591,7 +589,6 @@ public override void CopyTo(Stream destination, int bufferSize)

}

[HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public override Task WriteAsync(Byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
Expand Down
18 changes: 0 additions & 18 deletions src/coreclr/src/mscorlib/src/System/IO/Stream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ internal SemaphoreSlim EnsureAsyncActiveSemaphoreInitialized()
}
}

[HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public Task CopyToAsync(Stream destination)
{
Expand Down Expand Up @@ -147,14 +146,12 @@ public Task CopyToAsync(Stream destination)
return CopyToAsync(destination, bufferSize);
}

[HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public Task CopyToAsync(Stream destination, Int32 bufferSize)
{
return CopyToAsync(destination, bufferSize, CancellationToken.None);
}

[HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public virtual Task CopyToAsync(Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
{
Expand Down Expand Up @@ -281,14 +278,12 @@ protected virtual void Dispose(bool disposing)

public abstract void Flush();

[HostProtection(ExternalThreading=true)]
[ComVisible(false)]
public Task FlushAsync()
{
return FlushAsync(CancellationToken.None);
}

[HostProtection(ExternalThreading=true)]
[ComVisible(false)]
public virtual Task FlushAsync(CancellationToken cancellationToken)
{
Expand All @@ -303,14 +298,12 @@ protected virtual WaitHandle CreateWaitHandle()
return new ManualResetEvent(false);
}

[HostProtection(ExternalThreading=true)]
public virtual IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, Object state)
{
Contract.Ensures(Contract.Result<IAsyncResult>() != null);
return BeginReadInternal(buffer, offset, count, callback, state, serializeAsynchronously: false, apm: true);
}

[HostProtection(ExternalThreading = true)]
internal IAsyncResult BeginReadInternal(
byte[] buffer, int offset, int count, AsyncCallback callback, Object state,
bool serializeAsynchronously, bool apm)
Expand Down Expand Up @@ -405,14 +398,12 @@ public virtual int EndRead(IAsyncResult asyncResult)
}
}

[HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public Task<int> ReadAsync(Byte[] buffer, int offset, int count)
{
return ReadAsync(buffer, offset, count, CancellationToken.None);
}

[HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public virtual Task<int> ReadAsync(Byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
Expand Down Expand Up @@ -451,14 +442,12 @@ private struct ReadWriteParameters // struct for arguments to Read and Write cal



[HostProtection(ExternalThreading=true)]
public virtual IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, Object state)
{
Contract.Ensures(Contract.Result<IAsyncResult>() != null);
return BeginWriteInternal(buffer, offset, count, callback, state, serializeAsynchronously: false, apm: true);
}

[HostProtection(ExternalThreading = true)]
internal IAsyncResult BeginWriteInternal(
byte[] buffer, int offset, int count, AsyncCallback callback, Object state,
bool serializeAsynchronously, bool apm)
Expand Down Expand Up @@ -701,7 +690,6 @@ void ITaskCompletionAction.Invoke(Task completingTask)
bool ITaskCompletionAction.InvokeMayRunArbitraryCode { get { return true; } }
}

[HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public Task WriteAsync(Byte[] buffer, int offset, int count)
{
Expand All @@ -710,7 +698,6 @@ public Task WriteAsync(Byte[] buffer, int offset, int count)



[HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public virtual Task WriteAsync(Byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
Expand Down Expand Up @@ -782,7 +769,6 @@ public virtual void WriteByte(byte value)
Write(oneByteArray, 0, 1);
}

[HostProtection(Synchronization=true)]
public static Stream Synchronized(Stream stream)
{
if (stream==null)
Expand Down Expand Up @@ -928,7 +914,6 @@ public override Task FlushAsync(CancellationToken cancellationToken)
Task.CompletedTask;
}

[HostProtection(ExternalThreading = true)]
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, Object state)
{
if (!CanRead) __Error.ReadNotSupported();
Expand All @@ -945,7 +930,6 @@ public override int EndRead(IAsyncResult asyncResult)
return BlockingEndRead(asyncResult);
}

[HostProtection(ExternalThreading = true)]
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, Object state)
{
if (!CanWrite) __Error.WriteNotSupported();
Expand Down Expand Up @@ -1217,7 +1201,6 @@ public override int ReadByte()
return _stream.ReadByte();
}

[HostProtection(ExternalThreading=true)]
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, Object state)
{
bool overridesBeginRead = _stream.HasOverriddenBeginEndRead();
Expand Down Expand Up @@ -1271,7 +1254,6 @@ public override void WriteByte(byte b)
_stream.WriteByte(b);
}

[HostProtection(ExternalThreading=true)]
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, Object state)
{
bool overridesBeginWrite = _stream.HasOverriddenBeginEndWrite();
Expand Down
4 changes: 0 additions & 4 deletions src/coreclr/src/mscorlib/src/System/IO/StreamReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,6 @@ public override String ReadLine()
}

#region Task based Async APIs
[HostProtection(ExternalThreading=true)]
[ComVisible(false)]
public override Task<String> ReadLineAsync()
{
Expand Down Expand Up @@ -855,7 +854,6 @@ private async Task<String> ReadLineAsyncInternal()
return GetStringAndReleaseSharedStringBuilder(sb);
}

[HostProtection(ExternalThreading=true)]
[ComVisible(false)]
public override Task<String> ReadToEndAsync()
{
Expand Down Expand Up @@ -892,7 +890,6 @@ private async Task<String> ReadToEndAsyncInternal()
return GetStringAndReleaseSharedStringBuilder(sb);
}

[HostProtection(ExternalThreading=true)]
[ComVisible(false)]
public override Task<int> ReadAsync(char[] buffer, int index, int count)
{
Expand Down Expand Up @@ -1080,7 +1077,6 @@ internal override async Task<int> ReadAsyncInternal(char[] buffer, int index, in
return charsRead;
}

[HostProtection(ExternalThreading=true)]
[ComVisible(false)]
public override Task<int> ReadBlockAsync(char[] buffer, int index, int count)
{
Expand Down
8 changes: 0 additions & 8 deletions src/coreclr/src/mscorlib/src/System/IO/StreamWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ public override void Write(String value)
}

#region Task based Async APIs
[HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public override Task WriteAsync(char value)
{
Expand Down Expand Up @@ -457,7 +456,6 @@ public override Task WriteAsync(char value)
_this.CharPos_Prop = charPos;
}

[HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public override Task WriteAsync(String value)
{
Expand Down Expand Up @@ -543,7 +541,6 @@ public override Task WriteAsync(String value)
_this.CharPos_Prop = charPos;
}

[HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public override Task WriteAsync(char[] buffer, int index, int count)
{
Expand Down Expand Up @@ -631,7 +628,6 @@ public override Task WriteAsync(char[] buffer, int index, int count)
_this.CharPos_Prop = charPos;
}

[HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public override Task WriteLineAsync()
{
Expand All @@ -654,7 +650,6 @@ public override Task WriteLineAsync()
}


[HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public override Task WriteLineAsync(char value)
{
Expand All @@ -677,7 +672,6 @@ public override Task WriteLineAsync(char value)
}


[HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public override Task WriteLineAsync(String value)
{
Expand All @@ -700,7 +694,6 @@ public override Task WriteLineAsync(String value)
}


[HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public override Task WriteLineAsync(char[] buffer, int index, int count)
{
Expand Down Expand Up @@ -733,7 +726,6 @@ public override Task WriteLineAsync(char[] buffer, int index, int count)
}


[HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public override Task FlushAsync()
{
Expand Down
Loading

0 comments on commit f06e41a

Please sign in to comment.