compio-rs / compio

A thread-per-core Rust runtime with IOCP/io_uring/polling.
MIT License
420 stars 37 forks source link

Make schedule Send with panics. #109

Closed Berrysoft closed 1 year ago

Berrysoft commented 1 year ago

However, simply calling wake in other threads may not trigger reschedule. Therefore I don't know how to construct a panic test.

Closes #108 . According to the votes of the maintainers, we don't want to support futures channel working cross thread.

Berrysoft commented 1 year ago

Where is the Send impl

In std:)

You can see the comment of spawn_unchecked:

If schedule is not [Send] and [Sync], all instances of the [Runnable]'s [Waker] must be used and dropped on the original thread.

As we cannot stop the user use and drop the waker on other threads, we should panic to make schedule Send and Sync.

George-Miao commented 1 year ago

Does that mean the old impl we have are unsound?

Berrysoft commented 1 year ago

I think so.