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

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStephen Toub <stoub@microsoft.com>2016-04-14 16:35:19 +0300
committerStephen Toub <stoub@microsoft.com>2016-04-14 16:35:19 +0300
commitb4be6407b7034f24484a4e252455151798cca91c (patch)
tree14d32bf0a1210b317dca2c8bdcbad809cd07a335 /src
parent6444a9c861930899c46ec848b55d6c0cd2240220 (diff)
parent0ff0ff32ee0be27863d193f60e0d5a2f2596dd78 (diff)
Merge pull request #7729 from jamesqo/stream-tasks
Use Task.FromCanceled in Stream
Diffstat (limited to 'src')
-rw-r--r--src/System.IO/src/System/IO/Stream.cs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/System.IO/src/System/IO/Stream.cs b/src/System.IO/src/System/IO/Stream.cs
index f70d6cd41a..cce242278f 100644
--- a/src/System.IO/src/System/IO/Stream.cs
+++ b/src/System.IO/src/System/IO/Stream.cs
@@ -247,7 +247,7 @@ namespace System.IO
{
if (cancellationToken.IsCancellationRequested)
{
- return new Task(() => { }, cancellationToken);
+ return Task.FromCanceled(cancellationToken);
}
return Task.Factory.StartNew(state => ((Stream)state).Flush(), this,
@@ -268,7 +268,7 @@ namespace System.IO
if (cancellationToken.IsCancellationRequested)
{
- return new Task<int>(() => 0, cancellationToken);
+ return Task.FromCanceled<int>(cancellationToken);
}
// To avoid a race with a stream's position pointer & generating race
@@ -304,7 +304,7 @@ namespace System.IO
if (cancellationToken.IsCancellationRequested)
{
- return new Task(() => { }, cancellationToken);
+ return Task.FromCanceled(cancellationToken);
}
// To avoid a race with a stream's position pointer & generating race