mozilla/rust — pull request #11462 by alexcrichton (2014-01-11 00:50:22+00:00)
Title: Implement an efficient mutex in `std::sync`

These commits introduce `Mutex` and `StaticMutex` types in libstd as first-class primitives. One of the major goals of this implementation is to be efficient with a threshold of pthread mutexes as the benchmark.

Most of the comments can be found on the mutex module itself and I won't repeat the details here. The good news is that this allows for a different building block of `libextra` which means that `try_send_deferred` can now be completely removed!

In profiling, native performance is the same as pthreads performance, and green performance is about 3x faster than pthreads pending fixes to the scheduler that doesn't attempt to fan out all workloads as quickly as possible.