doc-push icon indicating copy to clipboard operation
doc-push copied to clipboard

No mention of thread-local variables in "Getting started" guide

Open carllerche opened this issue 7 years ago • 2 comments

The Future trait uses a thread-local variable to track the current task. This should be discussed in the "Getting started" guide as it is a common question.

carllerche avatar Oct 03 '18 22:10 carllerche

Do we think there needs to be discussed in depth? It seems like this would be a good thing for an "aside" where we say "by the way, the current task is kept track of in a thread local variable. If you want to know more, check out this internals guide with more information". I think the getting started guide should really focus on usage, and reserve answering any burning questions about implementation in asides.

rylev avatar Oct 04 '18 19:10 rylev

This has come out quite often as a point of confusion in the past. It should be mentioned when Future::poll is. The thread-local is the missing piece to understand how returning Async::NotReady can result in the executor polling the future when appropriate.

carllerche avatar Oct 04 '18 20:10 carllerche