News for hackers. Stuff that matters.
Re:Rust 0.12.0 released by blinkingled on Thursday October 09, 2014 @02:40PM (#8434304)
Does the RFC230 (https://github.com/rust-lang/rfcs/pull/230) removal of green threads give me out of box 1:1 threading or just that std::io uses native threads and the rest has to use green threads only now as an additional outside dependency? Kinda confused given I don't follow Rust all that much.

Really odd that they went with M:N model - if the OS is fast at creating/destroying threads 1:1 is the best model for vast majority of apps.

Re:Rust 0.12.0 released by wycats on Thursday October 09, 2014 @02:42PM (#8434317)
The default is 1:1 threads. If you use `spawn` in Rust, you get a native thread.
Re:Rust 0.12.0 released by blinkingled on Thursday October 09, 2014 @02:45PM (#8434333)
Oh, it is? I must be reading some old docs and mailing list discussions. That's great to hear. Thanks for the clarification!
Re:Rust 0.12.0 released by steveklabnik on Thursday October 09, 2014 @02:56PM (#8434397)
It's changed a number of times. First it was M:N, then 1:1 was added, then 1:1 was made the default, now M:N is getting removed.
Re:Rust 0.12.0 released by sitkack on Thursday October 09, 2014 @03:09PM (#8434459)
Does anything preclude M:N threading in a library? It is really useful in quite a number of scenarios.
Re:Rust 0.12.0 released by steveklabnik on Thursday October 09, 2014 @03:24PM (#8434523)
The existing libgreen will be moved out to a Cargo library. You just won't be able to seamlessly switch between the two like you did before, you'll have to explicitly use the green threading API instead.
Re:Rust 0.12.0 released by Blackthorn on Thursday October 09, 2014 @06:27PM (#8435337)
How will this work if you depend on a lib that uses traditional threading but want to use green threads yourself? That actually comes up a lot at my work.
Re:Rust 0.12.0 released by steveklabnik on Thursday October 09, 2014 @06:43PM (#8435399)
You'd have to use one that uses green threads internally.

Basically, in the effort to make the abstraction Just Work between 1:1 and N:M threading, we made green threads so heavyweight that they barely even qualified as green anymore. It's only by removing that abstraction that we could feasibly make them lightweight again.

Re:Rust 0.12.0 released by kibwen on Thursday October 09, 2014 @06:59PM (#8435445)
The current implementation that's being phased out was designed to abstract away the threading model such that libraries could make use of concurrency while the programs that use those libraries could use any threading model they choose, and it would all Just Work. However, in practice this caused too many compromises in the implementation of both the native thread runtime and the green thread runtime, erasing the benefits of both.

Sorry! We're sensitive to your use case, but we just couldn't make it work.

Re:Rust 0.12.0 released by pcwalton on Thursday October 09, 2014 @11:21PM (#8436111)
No, and we actually use a "tasklet" library in Servo for the really fine-grained parallelism (per-CSS-block) where any allocation on task spawn would be far too expensive and work stealing is essential.
Re:Rust 0.12.0 released by sitkack on Sunday October 12, 2014 @07:27PM (#8446920)
Could you point me to this? I did a cursory look through the Servo codebase. It just occurred to me that since Servo is pretty much the reason for the existence of Rust, it is probably the best thing to learn Rust by reading code.

I have had a problem learning Rust by example, the codebases I would like to read don't usually work with the latest Rust releases.

I don't really _do_ C++, but if I could talk to Rust from C++ maybe I could start hacking on their codebases.

Edit: I found the http://doc.rust-lang.org/green/index.html is this what you are referring to?

Re:Rust 0.12.0 released by kibwen on Thursday October 09, 2014 @03:20PM (#8434506)
I believe the goal is for there to be an officially-supported green threading library, yes.