Imported Upstream version 4.2.1.91
Former-commit-id: 5bd0f48812d39b3636887951adc772b94ef2f5af
This commit is contained in:
parent
2faab2dafa
commit
f1bb32afc3
@ -71,7 +71,7 @@ namespace System.Threading
|
||||
/// actually run the callbacks.
|
||||
private volatile int m_threadIDExecutingCallbacks = -1;
|
||||
|
||||
private bool m_disposed;
|
||||
private int m_disposed;
|
||||
|
||||
private CancellationTokenRegistration [] m_linkingRegistrations; //lazily initialized if required.
|
||||
|
||||
@ -134,7 +134,7 @@ namespace System.Threading
|
||||
/// </summary>
|
||||
internal bool IsDisposed
|
||||
{
|
||||
get { return m_disposed; }
|
||||
get { return m_disposed == 1; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -573,7 +573,7 @@ namespace System.Threading
|
||||
// mutates a sparseArrayFragment and then reads from properties of the CTS that are not
|
||||
// invalidated by cts.Dispose().
|
||||
|
||||
if (m_disposed)
|
||||
if (m_disposed != 0 || Interlocked.CompareExchange (ref m_disposed, 1, 0) != 0)
|
||||
return;
|
||||
|
||||
if (m_timer != null) m_timer.Dispose();
|
||||
@ -598,8 +598,6 @@ namespace System.Threading
|
||||
m_kernelEvent.Close(); // the critical cleanup to release an OS handle
|
||||
m_kernelEvent = null; // free for GC.
|
||||
}
|
||||
|
||||
m_disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -613,7 +611,7 @@ namespace System.Threading
|
||||
#endif
|
||||
internal void ThrowIfDisposed()
|
||||
{
|
||||
if (m_disposed)
|
||||
if (m_disposed == 1)
|
||||
ThrowObjectDisposedException();
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
{
|
||||
this.binPath = binPath;
|
||||
this.buildEnabled = true;
|
||||
this.projects = new Dictionary <string, Project> ();
|
||||
this.projects = new Dictionary <string, Project> (StringComparer.OrdinalIgnoreCase);
|
||||
this.eventSource = new EventSource ();
|
||||
this.loggers = new List <ILogger> ();
|
||||
this.buildStarted = false;
|
||||
|
@ -410,7 +410,6 @@ namespace MonoTests.Mono.Unix {
|
||||
const int StormCount = 100000;
|
||||
|
||||
[Test]
|
||||
[Category("NotOnMac")] // OSX signal storming will not deliver every one
|
||||
public void TestRaiseStorm ()
|
||||
{
|
||||
UnixSignal[] usignals = CreateSignals (signals);
|
||||
@ -424,7 +423,7 @@ namespace MonoTests.Mono.Unix {
|
||||
t.Start ();
|
||||
foreach (Thread t in threads)
|
||||
t.Join ();
|
||||
AssertCount (usignals);
|
||||
AssertCountSet (usignals);
|
||||
CloseSignals (usignals);
|
||||
}
|
||||
|
||||
@ -436,6 +435,13 @@ namespace MonoTests.Mono.Unix {
|
||||
Assert.AreEqual (sum, StormCount);
|
||||
}
|
||||
|
||||
static void AssertCountSet (UnixSignal[] usignals)
|
||||
{
|
||||
foreach (UnixSignal s in usignals) {
|
||||
Assert.IsTrue (s.Count > 0);
|
||||
}
|
||||
}
|
||||
|
||||
static UnixSignal[] CreateSignals (Signum[] signals)
|
||||
{
|
||||
UnixSignal[] s = new UnixSignal [signals.Length];
|
||||
@ -462,7 +468,6 @@ namespace MonoTests.Mono.Unix {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("NotOnMac")] // OSX signal storming will not deliver every one
|
||||
public void TestAddRemove ()
|
||||
{
|
||||
UnixSignal[] usignals = CreateSignals (signals);
|
||||
@ -477,7 +482,7 @@ namespace MonoTests.Mono.Unix {
|
||||
foreach (Thread t in threads)
|
||||
t.Join ();
|
||||
|
||||
AssertCount (usignals);
|
||||
AssertCountSet (usignals);
|
||||
CloseSignals (usignals);
|
||||
}
|
||||
|
||||
@ -497,7 +502,6 @@ namespace MonoTests.Mono.Unix {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("NotOnMac")] // OSX signal storming will not deliver every one
|
||||
public void TestWaitAny ()
|
||||
{
|
||||
UnixSignal[] usignals = CreateSignals (signals);
|
||||
@ -515,7 +519,7 @@ namespace MonoTests.Mono.Unix {
|
||||
foreach (Thread t in threads)
|
||||
t.Join ();
|
||||
|
||||
AssertCount (usignals);
|
||||
AssertCountSet (usignals);
|
||||
CloseSignals (usignals);
|
||||
}
|
||||
|
||||
|
@ -243,6 +243,17 @@ namespace MonoTests.System.Linq.Expressions {
|
||||
return 42;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CallMethodOnDateTime ()
|
||||
{
|
||||
var left = Expression.Call (Expression.Constant (DateTime.Now), typeof(DateTime).GetMethod ("AddDays"), Expression.Constant (-5.0));
|
||||
var right = Expression.Constant (DateTime.Today);
|
||||
var expr = Expression.GreaterThan (left, right);
|
||||
|
||||
var eq = Expression.Lambda<Func<bool>> (expr).Compile ();
|
||||
Assert.IsFalse (eq ());
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotDotNet")] // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=339351
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
@ -398,7 +409,6 @@ namespace MonoTests.System.Linq.Expressions {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorkingInterpreter")]
|
||||
public void Connect282702 ()
|
||||
{
|
||||
var lambda = Expression.Lambda<Func<Func<int>>> (
|
||||
|
@ -93,6 +93,18 @@ namespace MonoTests.System.Linq.Expressions
|
||||
Assert.IsFalse (eq ());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void StringWithNull ()
|
||||
{
|
||||
BinaryExpression expr = Expression.Equal (Expression.Constant ("a"), Expression.Constant (null));
|
||||
Assert.AreEqual (ExpressionType.Equal, expr.NodeType);
|
||||
Assert.AreEqual (typeof (bool), expr.Type);
|
||||
Assert.IsNull (expr.Method);
|
||||
|
||||
var eq = Expression.Lambda<Func<bool>> (expr).Compile ();
|
||||
Assert.IsFalse (eq ());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Nullable_LiftToNull_SetToFalse ()
|
||||
{
|
||||
|
@ -79,6 +79,30 @@ namespace MonoTests.System.Linq.Expressions
|
||||
Assert.AreEqual ("(1 != 2)", expr.ToString ());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PrimitiveNonNumeric ()
|
||||
{
|
||||
BinaryExpression expr = Expression.NotEqual (Expression.Constant ('a'), Expression.Constant ('b'));
|
||||
Assert.AreEqual (ExpressionType.NotEqual, expr.NodeType);
|
||||
Assert.AreEqual (typeof (bool), expr.Type);
|
||||
Assert.IsNull (expr.Method);
|
||||
|
||||
var eq = Expression.Lambda<Func<bool>> (expr).Compile ();
|
||||
Assert.IsTrue (eq ());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void StringWithNull ()
|
||||
{
|
||||
BinaryExpression expr = Expression.NotEqual (Expression.Constant ("a"), Expression.Constant (null));
|
||||
Assert.AreEqual (ExpressionType.NotEqual, expr.NodeType);
|
||||
Assert.AreEqual (typeof (bool), expr.Type);
|
||||
Assert.IsNull (expr.Method);
|
||||
|
||||
var eq = Expression.Lambda<Func<bool>> (expr).Compile ();
|
||||
Assert.IsTrue (eq ());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Nullable_LiftToNull_SetToFalse ()
|
||||
{
|
||||
|
@ -1 +1 @@
|
||||
fbc2bff995e010b1e2e97373f5bd7a86db9b7aba
|
||||
59e3f322dd87722098b2661868ee3cd268f44676
|
@ -152,10 +152,7 @@ namespace System
|
||||
stdin = new CStreamReader (OpenStandardInput (0), inputEncoding);
|
||||
} else {
|
||||
#endif
|
||||
// FULL_AOT_RUNTIME is used (instead of MONOTOUCH) since we only want this code when running on
|
||||
// iOS (simulator or devices) and *not* when running tools (e.g. btouch #12179) that needs to use
|
||||
// the mscorlib.dll shipped with Xamarin.iOS
|
||||
#if MONOTOUCH && FULL_AOT_RUNTIME
|
||||
#if MONOTOUCH
|
||||
stdout = new NSLogWriter ();
|
||||
#else
|
||||
stdout = new UnexceptionalStreamWriter (OpenStandardOutput (0), outputEncoding);
|
||||
@ -163,7 +160,7 @@ namespace System
|
||||
#endif
|
||||
stdout = TextWriter.Synchronized (stdout);
|
||||
|
||||
#if MONOTOUCH && FULL_AOT_RUNTIME
|
||||
#if MONOTOUCH
|
||||
stderr = new NSLogWriter ();
|
||||
#else
|
||||
stderr = new UnexceptionalStreamWriter (OpenStandardError (0), outputEncoding);
|
||||
|
@ -7,7 +7,7 @@
|
||||
// Copyright 2012-2014 Xamarin Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#if FULL_AOT_RUNTIME
|
||||
#if MONOTOUCH
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
@ -549,8 +549,7 @@ namespace System {
|
||||
return GetFolderPath (folder, SpecialFolderOption.None);
|
||||
}
|
||||
|
||||
// for monotouch, not monotouch_runtime
|
||||
#if !(MONOTOUCH && FULL_AOT_RUNTIME)
|
||||
#if !MONOTOUCH
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
private extern static string GetWindowsFolderPath (int folder);
|
||||
|
||||
|
@ -33,7 +33,6 @@ using System;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
using System.Threading.Tasks;
|
||||
using MonoTests.System.Threading.Tasks;
|
||||
|
||||
namespace MonoTests.System.Threading
|
||||
{
|
||||
@ -447,10 +446,11 @@ namespace MonoTests.System.Threading
|
||||
Assert.IsTrue (canceled, "#3");
|
||||
}
|
||||
|
||||
[Category ("NotWorking")] // why would linked token be imune to ObjectDisposedException on Cancel?
|
||||
[Test]
|
||||
public void ConcurrentCancelLinkedTokenSourceWhileDisposing ()
|
||||
{
|
||||
ParallelTestHelper.Repeat (delegate {
|
||||
for (int i = 0, total = 500; i < total; ++i) {
|
||||
var src = new CancellationTokenSource ();
|
||||
var linked = CancellationTokenSource.CreateLinkedTokenSource (src.Token);
|
||||
var cntd = new CountdownEvent (2);
|
||||
@ -470,20 +470,19 @@ namespace MonoTests.System.Threading
|
||||
t2.Start ();
|
||||
t1.Join (500);
|
||||
t2.Join (500);
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
[Test]
|
||||
public void DisposeRace ()
|
||||
{
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
for (int i = 0, total = 1000; i < total; ++i) {
|
||||
var c1 = new CancellationTokenSource ();
|
||||
using (c1) {
|
||||
var wh = c1.Token.WaitHandle;
|
||||
c1.CancelAfter (1);
|
||||
Thread.Sleep (1);
|
||||
}
|
||||
var wh = c1.Token.WaitHandle;
|
||||
c1.CancelAfter (1);
|
||||
Thread.Sleep (1);
|
||||
c1.Dispose ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1 +1 @@
|
||||
1fdb613e86f18f2b9886f4967a0bdc43f79fef7e
|
||||
7709d423804e0b435e60e7ca74f198f20d02a535
|
@ -1 +1 @@
|
||||
70d97fe10dc6037275080996eac59af0d68e1561
|
||||
1dcbcac9b7a00d7ca093ca63316c407012521308
|
@ -1 +1 @@
|
||||
06bd1619ad328b5c34a59a366c095894e50efd56
|
||||
c49c24eeb8abb839f5be49574e83c8ad4caaa8e3
|
@ -1 +1 @@
|
||||
5b9fdc62b8f41a0b32a323e04f253e4de34cd483
|
||||
d6ee7490dcb9342db71705f7f6b807f6a85a6cf0
|
@ -1 +1 @@
|
||||
a6fc9a5ca70542579710af7ccfbd377501d45c30
|
||||
37a62e86a907ce0337c9690758f816e78370f82f
|
@ -10,7 +10,7 @@ struct S
|
||||
class C
|
||||
{
|
||||
public S Value {
|
||||
set { }
|
||||
set; get;
|
||||
}
|
||||
|
||||
static void Main ()
|
||||
|
@ -1 +1 @@
|
||||
4225b585eea7227c7a3a236f80f3f28a3dd9919b
|
||||
952a85f9aa45898c3fc21f1c1f92ff5f87a2df6a
|
@ -1 +1 @@
|
||||
acdcf32485d622ab24dcb505dba5e58729d82483
|
||||
f815830cd5626bb85f053420b1d6fcf19e0aeb2a
|
@ -1 +1 @@
|
||||
10fc11219613f2b3a69c251bbcc78e4adf6e8605
|
||||
4890a89176f14b897192c352ad5f41d0077e3047
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user