- 
                Notifications
    You must be signed in to change notification settings 
- Fork 268
Open
Labels
bugSomething isn't workingSomething isn't working
Description
As a runtime of thread-per-core model, mostly we works like running multiple independent threads in parallel. So we implemented it in a non-thread-safe way. For example, when maintaining refcount of task, we use UnsafeCell<usize>.
There are 2 problems here:
- There is no non-Send + non-Sync version of Waker/RawWakerVTable. As the document ofRawWakerVTable, all 4 functions must be thread safe.
 SinceWakerandRawWakerVTableare all defined by std library and they impl Send and Sync, so we cannot restrict users not pass them between threads. Even we can tell users not pass them, this is not a rusty way. We'd better let it crash on compiling or running, or, we have to make it really thread-safe.
- We support a syncfeature which implemented by passing waker that not belongs to current thread. This solves task execution problem on thread-per-core way, but the implementation itself is not thread safe. We have to transfrom the state in atomic way. The problems comes from thetaskmodule too, the same as the first problem. I believe problem create a VTable (raw_waker) in a thread 2 and call (wake_by_val) in thread 1 #117 is triggered by this problem.
So as a user, if you do not await across threads, you are not affected by the issue. The issue will be fixed soon.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working