rust/concurrency.md

13 lines
818 B
Markdown
Raw Normal View History

2015-06-18 23:04:48 -05:00
% Concurrency and Paralellism
Rust as a language doesn't *really* have an opinion on how to do concurrency or
parallelism. The standard library exposes OS threads and blocking sys-calls
2015-07-07 11:48:57 -05:00
because *everyone* has those, and they're uniform enough that you can provide
2015-06-18 23:04:48 -05:00
an abstraction over them in a relatively uncontroversial way. Message passing,
green threads, and async APIs are all diverse enough that any abstraction over
them tends to involve trade-offs that we weren't willing to commit to for 1.0.
2015-07-07 11:48:57 -05:00
However the way Rust models concurrency makes it relatively easy design your own
concurrency paradigm as a library and have *everyone else's* code Just Work
with yours. Just require the right lifetimes and Send and Sync where appropriate
2015-07-07 12:03:51 -05:00
and you're off to the races. Or rather, off to the... not... having... races.