Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
f16e145e
Commit
f16e145e
authored
Mar 11, 2018
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clenaup: ResultBox
parent
94d20d5e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
13 deletions
+11
-13
ResultBox.cs
StackExchange.Redis/StackExchange/Redis/ResultBox.cs
+11
-13
No files found.
StackExchange.Redis/StackExchange/Redis/ResultBox.cs
View file @
f16e145e
...
...
@@ -5,7 +5,7 @@
namespace
StackExchange.Redis
{
abstract
partial
class
ResultBox
internal
abstract
partial
class
ResultBox
{
protected
Exception
exception
;
...
...
@@ -32,12 +32,11 @@ protected static void IncrementAllocationCount()
static
partial
void
OnAllocated
();
}
sealed
class
ResultBox
<
T
>
:
ResultBox
internal
sealed
class
ResultBox
<
T
>
:
ResultBox
{
private
static
readonly
ResultBox
<
T
>[]
store
=
new
ResultBox
<
T
>[
64
];
private
object
stateOrCompletionSource
;
private
T
value
;
public
ResultBox
(
object
stateOrCompletionSource
)
...
...
@@ -96,18 +95,18 @@ public void SetResult(T value)
public
override
bool
TryComplete
(
bool
isAsync
)
{
if
(
stateOrCompletionSource
is
TaskCompletionSource
<
T
>)
if
(
stateOrCompletionSource
is
TaskCompletionSource
<
T
>
tcs
)
{
var
tcs
=
(
TaskCompletionSource
<
T
>)
stateOrCompletionSource
;
#if !PLAT_SAFE_CONTINUATIONS // we don't need to check in this scenario
if
(
isAsync
||
TaskSource
.
IsSyncSafe
(
tcs
.
Task
))
#endif
{
T
val
;
Exception
ex
;
UnwrapAndRecycle
(
this
,
true
,
out
val
,
out
ex
);
UnwrapAndRecycle
(
this
,
true
,
out
T
val
,
out
Exception
ex
);
if
(
ex
==
null
)
tcs
.
TrySetResult
(
val
);
if
(
ex
==
null
)
{
tcs
.
TrySetResult
(
val
);
}
else
{
if
(
ex
is
TaskCanceledException
)
tcs
.
TrySetCanceled
();
...
...
@@ -144,5 +143,4 @@ private void Reset(object stateOrCompletionSource)
this
.
stateOrCompletionSource
=
stateOrCompletionSource
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment