summary refs log tree commit diff
path: root/src/libstd/rt/local_ptr.rs
AgeCommit message (Collapse)AuthorLines
2014-03-28Convert most code to new inner attribute syntax.Brian Anderson-1/+1
Closes #2569
2014-03-01Publicise types/add #[allow(visible_private_types)] to a variety of places.Huon Wilson-0/+1
There's a lot of these types in the compiler libraries, and a few of the older or private stdlib ones. Some types are obviously meant to be public, others not so much.
2014-01-22Replace C types with Rust types in libstd, closes #7313Florian Hahn-7/+5
2014-01-21Flag all TLS functions as inline(never)Alex Crichton-4/+58
There's lots of fun rationale in the comments of the diff. Closes #11683
2014-01-07std: Fill in all missing importsAlex Crichton-0/+3
Fallout from the previous commits
2014-01-01auto merge of #11212 : alexcrichton/rust/local-task-count, r=brsonbors-0/+40
For libgreen, bookeeping should not be global but rather on a per-pool basis. Inside libnative, it's known that there must be a global counter with a mutex/cvar. The benefit of taking this strategy is to remove this functionality from libstd to allow fine-grained control of it through libnative/libgreen. Notably, helper threads in libnative can manually decrement the global count so they don't count towards the global count of threads. Also, the shutdown process of *all* sched pools is now dependent on the number of tasks in the pool being 0 rather than this only being a hardcoded solution for the initial sched pool in libgreen. This involved adding a Local::try_take() method on the Local trait in order for the channel wakeup to work inside of libgreen. The channel send was happening from a SchedTask when there is no Task available in TLS, and now this is possible to work (remote wakeups are always possible, just a little slower).
2014-01-01Move task count bookeeping out of libstdAlex Crichton-0/+40
For libgreen, bookeeping should not be global but rather on a per-pool basis. Inside libnative, it's known that there must be a global counter with a mutex/cvar. The benefit of taking this strategy is to remove this functionality from libstd to allow fine-grained control of it through libnative/libgreen. Notably, helper threads in libnative can manually decrement the global count so they don't count towards the global count of threads. Also, the shutdown process of *all* sched pools is now dependent on the number of tasks in the pool being 0 rather than this only being a hardcoded solution for the initial sched pool in libgreen. This involved adding a Local::try_take() method on the Local trait in order for the channel wakeup to work inside of libgreen. The channel send was happening from a SchedTask when there is no Task available in TLS, and now this is possible to work (remote wakeups are always possible, just a little slower).
2013-12-31Convert relevant static mutexes to OnceAlex Crichton-12/+2
2013-12-25Test fixes and rebase conflictsAlex Crichton-3/+3
* 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-24std: Fix a bug where Local::take() didn't zero outAlex Crichton-1/+3
In the compiled version of local_ptr (that with #[thread_local]), the take() funciton didn't zero-out the previous pointer, allowing for multiple takes (with fewer runtime assertions being tripped).
2013-12-16Fallout of rewriting std::commAlex Crichton-2/+1
2013-12-10librustuv: RAII-ify `Local::borrow`, and remove some 12 Cells.Patrick Walton-10/+37
2013-12-08Remove dead codesKiet Tran-0/+2
2013-12-06Made Results API more composableMarvin Löbel-0/+1
2013-11-28Register new snapshotsAlex Crichton-2/+1
2013-11-27Use the native tls implementation on androidAlex Crichton-238/+219
Turns out android doesn't support LLVM's thread_local attribute and accompanying implementation. Closes #10686
2013-11-27Improve the rt::thread moduleAlex Crichton-2/+7
* Added doc comments explaining what all public functionality does. * Added the ability to spawn a detached thread * Added the ability for the procs to return a value in 'join'
2013-11-26Clean up statically initialized data on shutdownAlex Crichton-7/+24
Whenever the runtime is shut down, add a few hooks to clean up some of the statically initialized data of the runtime. Note that this is an unsafe operation because there's no guarantee on behalf of the runtime that there's no other code running which is using the runtime. This helps turn down the noise a bit in the valgrind output related to statically initialized mutexes. It doesn't turn the noise down to 0 because there are still statically initialized mutexes in dynamic_lib and os::with_env_lock, but I believe that it would be easy enough to add exceptions for those cases and I don't think that it's the runtime's job to go and clean up that data.
2013-11-26auto merge of #10312 : thestinger/rust/thread_local, r=alexcritchtonbors-5/+101
This provides a building block for fast thread-local storage. It does not change the safety semantics of `static mut`. Closes #10310
2013-11-26port the runtime to `#[thread_local]`Daniel Micay-5/+101
2013-11-26libstd: Remove all non-`proc` uses of `do` from libstdPatrick Walton-5/+1
2013-11-19libstd: Change all uses of `&fn(A)->B` over to `|A|->B` in libstdPatrick Walton-1/+1
2013-11-18Remove the C++ lock_and_signal typeAlex Crichton-3/+9
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-11Remove #[fixed_stack_segment] and #[rust_stack]Alex Crichton-2/+0
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-11De-pub some private runtime componentsAlex Crichton-1/+1
This change was waiting for privacy to get sorted out, which should be true now that #8215 has landed. Closes #4427
2013-09-25Don't die in try_unsafe_borrow if tls isn't readyAlex Crichton-6/+10
If there's no TLS key just yet, then there's nothing to unsafely borrow, so continue returning None. This prevents causing the runtime to abort itself when logging before the runtime is fully initialized. Closes #9487
2013-08-29rt: remove a series of unfortunate casts.Huon Wilson-13/+6
2013-08-24std: Convert the runtime TLS key to a Rust global to avoid FFIBrian Anderson-15/+17
2013-08-24std::rt: Optimize TLS use in change_task_contextBrian Anderson-0/+17
2013-08-24std: More TLS micro-optimizationBrian Anderson-3/+11
2013-08-19Add externfn macro and correctly label fixed_stack_segmentsNiko Matsakis-2/+4
2013-08-12std: Re-optimize tls access on local allocation pathBrian Anderson-2/+9
I did this once but acciddentally undid it in a later patch.
2013-08-04std::rt: Improve the error message when the thread-local ptr is nullBrian Anderson-11/+15
Also fix some incorrect comments and variable names.
2013-06-17std: Rename `abort!` to `rtabort!` to match other macrosBrian Anderson-1/+1
2013-06-04std::cell: Modernize constructorsPhilipp Brüschweiler-1/+1
Part of #3853
2013-05-22libstd: Fix merge fallout.Patrick Walton-0/+145