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
3065b79a
Commit
3065b79a
authored
Feb 01, 2020
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more words on thread theft
parent
efde95fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
ThreadTheft.md
docs/ThreadTheft.md
+4
-2
No files found.
docs/ThreadTheft.md
View file @
3065b79a
...
...
@@ -33,7 +33,7 @@ To *avoid* this, we use the
`TaskCreationOptions.RunContinuationsAsynchronously`
flag. What
*this*
does depends a little
on whether you have a
`SynchronizationContext`
. If you
*don't*
(common for console applications,
services, etc), then the TPL uses the standard thread-pool mechanisms to schedule the
work
continuation. If you
*do*
have a
`SynchronizationContext`
(common in UI applications
continuation. If you
*do*
have a
`SynchronizationContext`
(common in UI applications
and web-servers), then it's
`Post`
method is used instead; the
`Post`
method is
*meant*
to
be an asynchronous dispatch API. But... not all impementations are equal. Some
`SynchronizationContext`
implementations treat
`Post`
as a synchronous invoke. This is true
...
...
@@ -46,7 +46,9 @@ configure ASP.NET with:
```
In this scenario, we would once again end up with the reader being stolen and used for
processing your application logic.
processing your application logic. This can doom any further
`await`
s to timeouts,
either temporarily (until the application logic chooses to release the thread), or permanently
(essentially deadlocking yourself).
To avoid this, the library includes an additional layer of mistrust; specifically, if
the
`preventthreadtheft`
feature flag is enabled, we will
*pre-emptively*
queue the
...
...
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