3 ms·
Rust already has almost exactly this problem with keeping track of the current task in the async framework. As far as I know, the solution is indeed to use a th
by twic 4y ago
Rust already has almost exactly this problem with keeping track of the current task in the async framework. As far as I know, the solution is indeed to use a thread local, and be scrupulous about updating it on task entry. It's ugly but it seems to work.