From d151adb4feba0d0a4d070bdca2df9d933532e6be Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Thu, 26 Jun 2014 17:20:05 +0200 Subject: [PATCH] [corlib] Update racy test --- .../System.Runtime.CompilerServices/TaskAwaiterTest.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs b/mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs index b8fd573a366..74d5c548852 100644 --- a/mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs +++ b/mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs @@ -44,14 +44,15 @@ namespace MonoTests.System.Runtime.CompilerServices class Scheduler : TaskScheduler { string name; + int ic, qc; public Scheduler (string name) { this.name = name; } - public int InlineCalls { get; set; } - public int QueueCalls { get; set; } + public int InlineCalls { get { return ic; } } + public int QueueCalls { get { return qc; } } protected override IEnumerable GetScheduledTasks () { @@ -60,7 +61,7 @@ namespace MonoTests.System.Runtime.CompilerServices protected override void QueueTask (Task task) { - ++QueueCalls; + Interlocked.Increment (ref qc); ThreadPool.QueueUserWorkItem (o => { TryExecuteTask (task); }); @@ -68,7 +69,7 @@ namespace MonoTests.System.Runtime.CompilerServices protected override bool TryExecuteTaskInline (Task task, bool taskWasPreviouslyQueued) { - ++InlineCalls; + Interlocked.Increment (ref ic); return false; } } -- 2.25.1