|
|
|
|
|
by Ygg2
880 days ago
|
|
Green threads/Virtual threads are one solution, but then you need to ship a runtime for them, then you pay for what you don't use. Or don't standardize on them and have a split ecosystem of half libs supporting use `green-thread.rs` and the other half supporting `rust-gthreads`. |
|
Of course the problem then would be that Rust makes it trivially easy to call C code. As soon as someone in a green thread runtime called libc I/O functions directly they'd be in for a weird surprise when the call froze all threads on their worker.
Of course the "full" M:N runtime could be instrumented to print a warning when this occurs unless explicitly told not to, and std::thread in the "full" stdlib could allow explicit creation of full OS threads outside the runtime.
There is an attempt at doing this out there:
https://github.com/Xudong-Huang/may