Currently, we set the waker only on the first run of JoinHandle Future. Since it is Unpin, it can be moved to a different task, leaving an old waker which will cause a wakeup of the wrong task once the child task is done.
Please:
Consider the above and #32
- JoinHandle shall always set the waker on its poll
- The TLS Context for the worker shall always keep a handle to the currently running task set by the worker
- JoinHandle shall check if the connected task is safety, if yes, then it shall use
current task safety instead of the one in poll as ctx - this can cause some pesimizations in waking, but this seems to be the only way to ensure that a task that is starting a safety task can be woken into safety worker.
Please consider the above idea and develop alternative or improved proposals.