summary refs log tree commit diff
path: root/src/libstd/unstable/sync.rs
AgeCommit message (Collapse)AuthorLines
2014-03-23std: Move NativeMutex from &mut self to &selfAlex Crichton-2/+2
The proper usage of shared types is now sharing through `&self` rather than `&mut self` because the mutable version will provide stronger guarantees (no aliasing on *any* thread).
2014-03-13std: Rename Chan/Port types and constructorAlex Crichton-3/+3
* Chan<T> => Sender<T> * Port<T> => Receiver<T> * Chan::new() => channel() * constructor returns (Sender, Receiver) instead of (Receiver, Sender) * local variables named `port` renamed to `rx` * local variables named `chan` renamed to `tx` Closes #11765
2014-02-16std: add a NativeMutex type as a wrapper to destroy StaticNativeMutex.Huon Wilson-47/+7
This obsoletes LittleLock, and so it is removed.
2014-02-16std: Rename unstable::mutex::Mutex to StaticNativeMutex.Huon Wilson-3/+3
This better reflects its purpose and design.
2014-02-16std: add an RAII unlocker to Mutex.Huon Wilson-18/+6
This automatically unlocks its lock when it goes out of scope, and provides a safe(ish) method to call .wait.
2014-02-03std: Fix tests with io_error usageAlex Crichton-1/+1
2014-01-29Removing do keyword from libstd and librustcScott Lawrence-4/+4
2013-12-24std: Get stdtest all passing againAlex Crichton-2/+1
This commit brings the library up-to-date in order to get all tests passing again
2013-12-24std: Introduce std::syncAlex Crichton-477/+4
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
2013-12-16Fallout of rewriting std::commAlex Crichton-12/+11
2013-12-10libstd: Change `atomically` to use RAII.Patrick Walton-15/+45
2013-12-10libstd: Remove `Cell`s that were used because of `finally` by convertingPatrick Walton-27/+42
their `finally` blocks to RAII.
2013-12-08Remove dead codesKiet Tran-0/+1
2013-12-03Move std::util::ignore to std::prelude::dropSteven Fackler-4/+3
It's a more fitting name for the most common use case of this function.
2013-12-01remove useless `transmute_immut` functionDaniel Micay-1/+1
2013-11-28Register new snapshotsAlex Crichton-1/+1
2013-11-26librustc: Fix merge fallout.Patrick Walton-2/+2
2013-11-26libstd: Remove all non-`proc` uses of `do` from libstdPatrick Walton-38/+19
2013-11-25Move LittleLock to using RAIIAlex Crichton-69/+50
This moves the locking/waiting methods to returning an RAII struct instead of relying on closures. Additionally, this changes the methods to all take '&mut self' to discourage recursive locking. The new method to block is to call `wait` on the returned RAII structure instead of calling it on the lock itself (this enforces that the lock is held). At the same time, this improves the Mutex interface a bit by allowing destruction of non-initialized members and by allowing construction of an empty mutex (nothing initialized inside).
2013-11-24Remove linked failure from the runtimeAlex Crichton-82/+58
The reasons for doing this are: * The model on which linked failure is based is inherently complex * The implementation is also very complex, and there are few remaining who fully understand the implementation * There are existing race conditions in the core context switching function of the scheduler, and possibly others. * It's unclear whether this model of linked failure maps well to a 1:1 threading model Linked failure is often a desired aspect of tasks, but we would like to take a much more conservative approach in re-implementing linked failure if at all. Closes #8674 Closes #8318 Closes #8863
2013-11-19libstd: Change all uses of `&fn(A)->B` over to `|A|->B` in libstdPatrick Walton-8/+8
2013-11-18Remove the C++ lock_and_signal typeAlex Crichton-25/+16
A the same time this purges all runtime support needed for statically initialized mutexes, moving all users over to the new Mutex type instead.
2013-11-13add rust_trylock_little_lockJason Toffaletti-1/+16
Try to acquire lock and succeed only if lock is not already held. Uses TryEnterCriticalSection or pthread_mutex_trylock.
2013-11-11Remove #[fixed_stack_segment] and #[rust_stack]Alex Crichton-6/+8
These two attributes are no longer useful now that Rust has decided to leave segmented stacks behind. It is assumed that the rust task's stack is always large enough to make an FFI call (due to the stack being very large). There's always the case of stack overflow, however, to consider. This does not change the behavior of stack overflow in Rust. This is still normally triggered by the __morestack function and aborts the whole process. C stack overflow will continue to corrupt the stack, however (as it did before this commit as well). The future improvement of a guard page at the end of every rust stack is still unimplemented and is intended to be the mechanism through which we attempt to detect C stack overflow. Closes #8822 Closes #10155
2013-10-28Register new snapshotsAlex Crichton-5/+4
2013-10-28Allow fail messages to be caught, and introduce the Any traitMarvin Löbel-11/+31
Some code cleanup, sorting of import blocks Removed std::unstable::UnsafeArc's use of Either Added run-fail tests for the new FailWithCause impls Changed future_result and try to return Result<(), ~Any>. - Internally, there is an enum of possible fail messages passend around. - In case of linked failure or a string message, the ~Any gets lazyly allocated in future_results recv method. - For that, future result now returns a wrapper around a Port. - Moved and renamed task::TaskResult into rt::task::UnwindResult and made it an internal enum. - Introduced a replacement typedef `type TaskResult = Result<(), ~Any>`.
2013-10-24Implement a basic event loop built on LittleLockAlex Crichton-0/+47
It's not guaranteed that there will always be an event loop to run, and this implementation will serve as an incredibly basic one which does not provide any I/O, but allows the scheduler to still run. cc #9128
2013-10-23Removed Unnecessary comments and white spaces #4386reedlepee-3/+0
2013-10-23Making fields in std and extra : private #4386reedlepee-2/+5
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-3/+3
Who doesn't like a massive renaming?
2013-10-18auto merge of #9926 : Kimundi/rust/future_result_bad_sig, r=huonwbors-7/+4
2013-10-18Made `std::task::TaskBuilder::future_result()` easier to useMarvin Löbel-7/+4
2013-10-17std: Move size/align functions to std::mem. #2240Brian Anderson-1/+1
2013-10-08make small ty_struct immediateDaniel Micay-1/+3
Closes #9651
2013-09-30std: Remove usage of fmt!Alex Crichton-3/+3
2013-09-18Register new snapshotsAlex Crichton-17/+0
2013-09-16switch Drop to `&mut self`Daniel Micay-2/+2
2013-08-29reduce the size of UnsafeArc from 2 words to 1Daniel Micay-1/+9
2013-08-27librustc: Ensure that type parameters are in the right positions in paths.Patrick Walton-1/+2
This removes the stacking of type parameters that occurs when invoking trait methods, and fixes all places in the standard library that were relying on it. It is somewhat awkward in places; I think we'll probably want something like the `Foo::<for T>::new()` syntax.
2013-08-27std: use ArcData rather than c_void in UnsafeArc.Huon Wilson-17/+12
This means that fewer `transmute`s are required, so there is less chance of a `transmute` not having the corresponding `forget` (possibly leading to use-after-free, etc).
2013-08-27Rename UnsafeAtomicRcBox to UnsafeArc. Fixes #7674.Huon Wilson-42/+42
2013-08-23std: Reduce TLS accessBrian Anderson-12/+16
2013-08-22Enabled unit tests in std and extra.Vadim Chugunov-3/+3
2013-08-19Add externfn macro and correctly label fixed_stack_segmentsNiko Matsakis-6/+20
2013-08-16Reserve 'yield' keywordKevin Ballard-10/+10
Rename task::yield() to task::deschedule(). Fixes #8494.
2013-08-12Don't use unkillable in UnsafeArc dtor when there's no unwrapper. Close #8382.Ben Blum-19/+21
2013-08-09Remove the C++ runtime. SayonaraBrian Anderson-31/+11
2013-08-09std: Fix perf of local allocations in newschedBrian Anderson-10/+16
Mostly optimizing TLS accesses to bring local heap allocation performance closer to that of oldsched. It's not completely at parity but removing the branches involved in supporting oldsched and optimizing pthread_get/setspecific to instead use our dedicated TCB slot will probably make up for it.
2013-08-03remove obsolete `foreach` keywordDaniel Micay-3/+3
this has been replaced by `for`
2013-08-02auto merge of #8195 : bblum/rust/task-cleanup, r=brsonbors-6/+4
In the first commit it is obvious why some of the barriers can be changed to ```Relaxed```, but it is not as obvious for the once I changed in ```kill.rs```. The rationale for those is documented as part of the documenting commit. Also the last commit is a temporary hack to prevent kill signals from being received in taskgroup cleanup code, which could be fixed in a more principled way once the old runtime is gone.