mozilla/rust — pull request #6839 by brson (2013-05-30 20:21:36+00:00)
Title: Scheduler multithreading

r? @nikomatsakis

This implements very basic multithreading in the new scheduler. This is only using a trivial work sharing strategy with a shared task queue. It adds three new concurrent types to the scheduler: `WorkQueue`, `MessageQueue`, and `SleeperList`. `WorkQueue` is temporarily just a basic queue; `MessageQueue` is a multiple-producer, singe-consumer queue for sending messages to schedulers, and `SleeperList` is a shared stack used for waking up sleeping schedulers. All three are intended to be lock free but for now are implemented naively with locks.

The main scheduling routine, which uses all three of these data structures is here: https://github.com/brson/rust/blob/io-upstream/src/libstd/rt/sched.rs#L144

An example of how the multithreaded scheduler is constructed: https://github.com/brson/rust/blob/io-upstream/src/libstd/rt/test.rs#L62

#4419