Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémie Laval <jeremie.laval@gmail.com>2011-03-21 15:26:52 +0300
committerJérémie Laval <jeremie.laval@gmail.com>2011-03-21 15:30:52 +0300
commit6623fc543d66d06121d7c7cfbe9f5bfa3ed8cf3d (patch)
tree135eede33517c266504a12b2326cac481666191f
parent1e38c9d065e4fecad427f5bd0b534f51de0c09ea (diff)
Revert fcbb5717c18ff8393f2300a254bb13e6fab9c7e4 and implement it differently.mono-android-1-0
The commit had the good idea but since some values of the enumeration overlap it broke the correct behavior. Instead we now turn off the extra options and use the previous way to check.
-rw-r--r--mcs/class/corlib/System.Threading.Tasks/Task.cs24
-rw-r--r--mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs3
2 files changed, 17 insertions, 10 deletions
diff --git a/mcs/class/corlib/System.Threading.Tasks/Task.cs b/mcs/class/corlib/System.Threading.Tasks/Task.cs
index d335c78feeb..5c497d8a76f 100644
--- a/mcs/class/corlib/System.Threading.Tasks/Task.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/Task.cs
@@ -283,26 +283,32 @@ namespace System.Threading.Tasks
int kindCode = (int)kind;
if (kindCode >= ((int)TaskContinuationOptions.NotOnRanToCompletion)) {
+ // Remove other options
+ kind &= ~(TaskContinuationOptions.PreferFairness
+ | TaskContinuationOptions.LongRunning
+ | TaskContinuationOptions.AttachedToParent
+ | TaskContinuationOptions.ExecuteSynchronously);
+
if (status == TaskStatus.Canceled) {
- if ((kind & TaskContinuationOptions.NotOnCanceled) > 0)
+ if (kind == TaskContinuationOptions.NotOnCanceled)
return false;
- if ((kind & TaskContinuationOptions.OnlyOnFaulted) > 0)
+ if (kind == TaskContinuationOptions.OnlyOnFaulted)
return false;
- if ((kind & TaskContinuationOptions.OnlyOnRanToCompletion) > 0)
+ if (kind == TaskContinuationOptions.OnlyOnRanToCompletion)
return false;
} else if (status == TaskStatus.Faulted) {
- if ((kind & TaskContinuationOptions.NotOnFaulted) > 0)
+ if (kind == TaskContinuationOptions.NotOnFaulted)
return false;
- if ((kind & TaskContinuationOptions.OnlyOnCanceled) > 0)
+ if (kind == TaskContinuationOptions.OnlyOnCanceled)
return false;
- if ((kind & TaskContinuationOptions.OnlyOnRanToCompletion) > 0)
+ if (kind == TaskContinuationOptions.OnlyOnRanToCompletion)
return false;
} else if (status == TaskStatus.RanToCompletion) {
- if ((kind & TaskContinuationOptions.NotOnRanToCompletion) > 0)
+ if (kind == TaskContinuationOptions.NotOnRanToCompletion)
return false;
- if ((kind & TaskContinuationOptions.OnlyOnFaulted) > 0)
+ if (kind == TaskContinuationOptions.OnlyOnFaulted)
return false;
- if ((kind & TaskContinuationOptions.OnlyOnCanceled) > 0)
+ if (kind == TaskContinuationOptions.OnlyOnCanceled)
return false;
}
}
diff --git a/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs b/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs
index 298be1864af..11971889e02 100644
--- a/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs
+++ b/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs
@@ -162,7 +162,8 @@ namespace MonoTests.System.Threading.Tasks
Task t = new Task(delegate { taskResult = true; }, src.Token);
src.Cancel ();
- Task cont = t.ContinueWith (delegate { result = true; }, TaskContinuationOptions.OnlyOnCanceled);
+ Task cont = t.ContinueWith (delegate { result = true; },
+ TaskContinuationOptions.OnlyOnCanceled | TaskContinuationOptions.ExecuteSynchronously);
t.Start();
cont.Wait();