about summary refs log tree commit diff
path: root/src/libstd/sync
AgeCommit message (Collapse)AuthorLines
2014-02-18Spellcheck library docs.Huon Wilson-2/+1
2014-02-15std: clean up ptr a bitCorey Richardson-1/+1
2014-02-11Rewrite channels yet again for upgradeabilityAlex Crichton-13/+16
This, the Nth rewrite of channels, is not a rewrite of the core logic behind channels, but rather their API usage. In the past, we had the distinction between oneshot, stream, and shared channels, but the most recent rewrite dropped oneshots in favor of streams and shared channels. This distinction of stream vs shared has shown that it's not quite what we'd like either, and this moves the `std::comm` module in the direction of "one channel to rule them all". There now remains only one Chan and one Port. This new channel is actually a hybrid oneshot/stream/shared channel under the hood in order to optimize for the use cases in question. Additionally, this also reduces the cognitive burden of having to choose between a Chan or a SharedChan in an API. My simple benchmarks show no reduction in efficiency over the existing channels today, and a 3x improvement in the oneshot case. I sadly don't have a pre-last-rewrite compiler to test out the old old oneshots, but I would imagine that the performance is comparable, but slightly slower (due to atomic reference counting). This commit also brings the bonus bugfix to channels that the pending queue of messages are all dropped when a Port disappears rather then when both the Port and the Chan disappear.
2014-02-11Shuffle around ownership in concurrent queuesAlex Crichton-267/+177
Beforehand, using a concurrent queue always mandated that the "shared state" be stored internally to the queues in order to provide a safe interface. This isn't quite as flexible as one would want in some circumstances, so instead this commit moves the queues to not containing the shared state. The queues no longer have a "default useful safe" interface, but rather a "default safe" interface (minus the useful part). The queues have to be shared manually through an Arc or some other means. This allows them to be a little more flexible at the cost of a usability hindrance. I plan on using this new flexibility to upgrade a channel to a shared channel seamlessly.
2014-02-04auto merge of #11230 : csherratt/rust/cow, r=alexcrichtonbors-0/+8
This allows patch adds a new arc type that allows for creation of copy-on-write data structures. The idea is that it is safe to mutate any data structure as long as it has only one reference to it. If there are multiple, it requires cloning of the data structure before mutation is possible.
2014-02-04Register new snapshotsAlex Crichton-190/+0
2014-02-04Replace NonCopyable usage with NoPodFlavio Percoco-20/+20
cc #10834
2014-02-03Various bug fixes and rebase conflictsAlex Crichton-1/+1
2014-02-03Add an AtomicU64 type to std::sync::atomicsAlex Crichton-32/+245
This also generalizes all atomic intrinsics over T so we'll be able to add u8 atomics if we really feel the need to (do we really want to?)
2014-02-01Make next_power_of_two generic for unsigned integersBrendan Zabarauskas-2/+2
Also rename `next_power_of_two_opt` to `checked_next_power_of_two`.
2014-01-29Removing do keyword from libstd and librustcScott Lawrence-20/+20
2014-01-26Removed all instances of XXX in preparation for relaxing of FIXME ruleSalem Talha-3/+3
2014-01-22libc: switch `free` to the proper signatureDaniel Micay-1/+1
This does not attempt to fully propagate the mutability everywhere, but gives new code a hint to avoid the same issues.
2014-01-22Replace C types with Rust types in libstd, closes #7313Florian Hahn-2/+1
2014-01-21[std::vec] Rename .remove_opt() to .remove(), drop the old .remove() behaviorSimon Sapin-1/+1
2014-01-21Remove unnecessary parentheses.Huon Wilson-1/+1
2014-01-17Add a generic power functionFlavio Percoco-2/+2
The patch adds a `pow` function for types implementing `One`, `Mul` and `Clone` trait. The patch also renames f32 and f64 pow into powf in order to still have a way to easily have float powers. It uses llvms intrinsics. The pow implementation for all num types uses the exponentiation by square. Fixes bug #11499
2014-01-09Merge some numeric traits with Real and don't re-export RealExtBrendan Zabarauskas-1/+1
The methods contained in `std::num::{Algebraic, Trigonometric, Exponential, Hyperbolic}` have now been moved into `std::num::Real`. This is part of an ongoing effort to simplify `std::num` (see issue #10387). `std::num::RealExt` has also been removed from the prelude because it is not a commonly used trait.
2013-12-31Add a copy-on-write container.Colin Sherratt-0/+8
2013-12-25Test fixes and rebase conflictsAlex Crichton-1/+1
* vec::raw::to_ptr is gone * Pausible => Pausable * Removing @ * Calling the main task "<main>" * Removing unused imports * Removing unused mut * Bringing some libextra tests up to date * Allowing compiletest to work at stage0 * Fixing the bootstrap-from-c rmake tests * assert => rtassert in a few cases * printing to stderr instead of stdout in fail!()
2013-12-24Test fixes and rebase problemsAlex Crichton-1/+1
Note that this removes a number of run-pass tests which are exercising behavior of the old runtime. This functionality no longer exists and is thoroughly tested inside of libgreen and libnative. There isn't really the notion of "starting the runtime" any more. The major notion now is "bootstrapping the initial task".
2013-12-24std: Get stdtest all passing againAlex Crichton-8/+22
This commit brings the library up-to-date in order to get all tests passing again
2013-12-24std: Introduce std::syncAlex Crichton-0/+2230
For now, this moves the following modules to std::sync * UnsafeArc (also removed unwrap method) * mpsc_queue * spsc_queue * atomics * mpmc_bounded_queue * deque We may want to remove some of the queues, but for now this moves things out of std::rt into std::sync