3 ms·
> Green threading: We are removing support from green threading from the standard library and moving it out into an external package. I only ever looked at Rus
by rubiquity 12y ago
> Green threading: We are removing support from green threading from the standard library and moving it out into an external package.
I only ever looked at Rust from a 500 foot view while toying with it at a Hackathon, but I had no clue it had so many different types of threading models. This seems like a step in the right direction, indeed. If Task is going to your unit of concurrent execution, as much transparency around that as possible is a good thing.
- masklinn 12y agoIt had just two: libgreen backed tasks with "green threads", libnative backed them with OS threads.
- rubiquity 12y agoDoes that mean every task will be an OS thread? Or are tasks handled by a runtime specific scheduler and will use a pool of threads for IO?
- hornetblack 12y agoGreen threading used to be default. And used libuv for io. Then native threading was avaliable. Then it became default. Now green threading is being moved out of builtin libs. Starting with green threads is really easy too: extern crate green; extern crate rustuv; #[start] fn start(argc: int, argv: *const *const u8) -> int { green::start(argc, argv, rustuv::event_loop, main) } fn main() { // this code is running in a pool of schedulers all powered by libuv } Edit: You can also start up a new libgreen scheduler pool at any time and add some native threads to the pool. So you can have some threads running with libgreen and some with libnative. (So you could theoretically embed a go program inside a rust program)