-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Using hyper on non-Send Executors #2341
Description
Hello Dear Friends,
I am interested in using your beautiful project in conjunction with https://github.com/DataDog/glommio/ instead of Tokio.
I know there are plenty of issues on how to use hyper with alternative executors, and I got that working just fine.
However, because glommio is a thread-per-core engine it requires that data doesn't leave a thread so our data structures are all ?Send.
Reading the code, it seems to me that the Send requirement arises only because the executor will require Send futures.
Indeed, my simple examples work if I do this:
unsafe impl Send for HyperStream {}
unsafe impl Send for HyperListener {}
Where HyperStream and HyperListener are our compat versions of the equivalent hyper data structures.
Although that work, I don't feel very safe: it's too easy for someone to, in the future, trust the Send guarantees and use that data cross-thread in a way that would break my code.
Tokio also has a local non-Send Executor so I am wondering if alternative versions of the API where Send is not a requirement would be welcome.
I am willing to do the work to make that happen, but let's discuss it first