Hi folks,
Many of you know this by now, but I'm sure there are people here who
didn't sit in the same room as me this summer (videoconference rooms
included).
This summer I worked on Rust's concurrency/parallelism libraries. I
contributed two shiny new features:
- Linked task failure. When spawning a task, you can optionally
configure whether failure (i.e., "fail", array out of bounds,
assertions, etc) propagates from child to parent and whether it
propagates from parent to child.
Of particular note is task::spawn_supervised, which allows you to
model a "supervision tree", in which if a parent task fails it will
automatically kill all of its descendants, but child task failure can
be handled gracefully.
- Shared mutable (typesafe) state. In addition to the ARC ("atomically
reference counted object"), which allows tasks to alias the same
immutable state, we now also have the RWARC ("reader-writer ARC"),
which uses locks and closures to allow tasks to share mutable state.
The type system statically guarantees that data-races are impossible.
See std::arc for more.
(The underlying concurrency primitives - semaphores, mutexes, rwlocks,
condvars - can also be used directly, in std::sync, in case you have
some state external to rust that needs to be protected, such as when
linking to a C library or using the filesystem. These should be
preferred over the pthread ones because these are rust-scheduler-
aware; i.e., other rust tasks can be scheduled on your CPU while you
are blocked on one of these.)
I wrote a series of blog posts, some of which explain Rust's features
and syntax, others of which explain these two projects:
http://winningraceconditions.blogspot.com/2012/09/rust-1-primer.html
http://winningraceconditions.blogspot.com/2012/09/rust-2-linked-task-failure.html
http://winningraceconditions.blogspot.com/2012/09/rust-3-typesafe-shared-state.html
http://winningraceconditions.blogspot.com/2012/09/rust-4-typesafe-shared-mutable-state.html
http://winningraceconditions.blogspot.com/2012/09/rust-0-index-and-conclusion.html
Thanks to you all - you're a great community, I really enjoyed
contributing this summer, and I have high hopes for Rust turning out to
be a great language.
Ben
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev