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
1013 B
38 lines
1013 B
// Needed for NET35 (ThreadLocal) |
|
#if !NET_4_6 |
|
using System; |
|
using LinqInternal.Threading.Needles; |
|
|
|
namespace LinqInternal.Threading |
|
{ |
|
internal static class ThreadLocalHelper |
|
{ |
|
private static readonly Exception _recursionGuardException; |
|
|
|
static ThreadLocalHelper() |
|
{ |
|
_recursionGuardException = GetInvalidOperationException(); |
|
} |
|
|
|
public static Exception RecursionGuardException |
|
{ |
|
get { return _recursionGuardException; } |
|
} |
|
|
|
private static InvalidOperationException GetInvalidOperationException() |
|
{ |
|
return new InvalidOperationException("Recursion"); |
|
} |
|
} |
|
|
|
internal static class ThreadLocalHelper<T> |
|
{ |
|
private static readonly INeedle<T> _recursionGuardNeedle = new ExceptionStructNeedle<T>(ThreadLocalHelper.RecursionGuardException); |
|
|
|
public static INeedle<T> RecursionGuardNeedle |
|
{ |
|
get { return _recursionGuardNeedle; } |
|
} |
|
} |
|
} |
|
#endif |