about summary refs log tree commit diff
path: root/src/libstd/rt/thread.rs
AgeCommit message (Collapse)AuthorLines
2014-02-09std: Add init and uninit to mem. Replace direct intrinsic usageBrian Anderson-3/+3
2014-01-31Use __pthread_get_minstack() when available.Ben Noordhuis-1/+46
glibc >= 2.15 has a __pthread_get_minstack() function that returns PTHREAD_STACK_MIN plus however many bytes are needed for thread-local storage. Use it when it's available because just PTHREAD_STACK_MIN is not enough in applications that have big thread-local storage requirements. Fixes #6233.
2014-01-31Retry on EINVAL from pthread_attr_setstacksize()Ben Noordhuis-5/+44
Enforce that the stack size is > RED_ZONE + PTHREAD_STACK_MIN. If the call to pthread_attr_setstacksize() subsequently fails with EINVAL, it means that the platform requires the stack size to be a multiple of the page size. In that case, round up to the nearest page and retry. Fixes #11694.
2014-01-29Removing do keyword from libstd and librustcScott Lawrence-3/+3
2014-01-25Uppercase numeric constantsChris Wong-2/+2
The following are renamed: * `min_value` => `MIN` * `max_value` => `MAX` * `bits` => `BITS` * `bytes` => `BYTES` Fixes #10010.
2014-01-22Replace C types with Rust types in libstd, closes #7313Florian Hahn-1/+1
2014-01-06Revert "std: adjust requested stack size for thread-local storage."Huon Wilson-19/+1
This reverts commit f1b5f59287106fc511d29c425255bd343608065c. Using a private function of a library is a bad idea: several people (on Linux) were meeting with linking errors because of it (different/older versions of glibc).
2014-01-04std: adjust requested stack size for thread-local storage.Huon Wilson-1/+19
If there is a lot of data in thread-local storage some implementations of pthreads (e.g. glibc) fail if you don't request a stack large enough -- by adjusting for the minimum size we guarantee that our stacks are always large enough. Issue #6233.
2013-12-25Test fixes and rebase conflictsAlex Crichton-4/+0
* 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: Update std::rt::thread to specify stack sizesAlex Crichton-8/+16
It's now possible to spawn an OS thread with a stack that has a specific size.
2013-12-24green: Rip the bandaid off, introduce libgreenAlex Crichton-0/+6
This extracts everything related to green scheduling from libstd and introduces a new libgreen crate. This mostly involves deleting most of std::rt and moving it to libgreen. Along with the movement of code, this commit rearchitects many functions in the scheduler in order to adapt to the fact that Local::take now *only* works on a Task, not a scheduler. This mostly just involved threading the current green task through in a few locations, but there were one or two spots where things got hairy. There are a few repercussions of this commit: * tube/rc have been removed (the runtime implementation of rc) * There is no longer a "single threaded" spawning mode for tasks. This is now encompassed by 1:1 scheduling + communication. Convenience methods have been introduced that are specific to libgreen to assist in the spawning of pools of schedulers.
2013-12-24std: Introduce an unstable::stack moduleAlex Crichton-2/+2
This module will be used to manage the OS-specific TLS registers used to specify the bounds of the current rust stack (useful in 1:1 and M:N)
2013-12-16Test fallout from std::comm rewriteAlex Crichton-5/+9
2013-12-16Fallout of rewriting std::commAlex Crichton-78/+109
2013-11-27Improve the rt::thread moduleAlex Crichton-58/+145
* 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-24std: Fix transmute error on win64klutzy-1/+1
2013-11-18libstd: Change all `~fn()`s to `proc`s in the standard library.Patrick Walton-4/+4
This makes `Cell`s no longer necessary in most cases.
2013-11-11Remove #[fixed_stack_segment] and #[rust_stack]Alex Crichton-7/+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-11-10Register new snapshotsAlex Crichton-10/+2
2013-11-05Move implementation for threads to RustDirkjan Bussink-30/+97
This binds to the appropriate pthreads_* and Windows specific functions and calls them from Rust. This allows for removal of the C++ support code for threads. Fixes #10162
2013-10-28Register new snapshotsAlex Crichton-4/+3
2013-10-23Making fields in std and extra : private #4386reedlepee-3/+3
2013-10-19Use __morestack to detect stack overflowAlex Crichton-11/+32
This commit resumes management of the stack boundaries and limits when switching between tasks. This additionally leverages the __morestack function to run code on "stack overflow". The current behavior is to abort the process, but this is probably not the best behavior in the long term (for deails, see the comment I wrote up in the stack exhaustion routine).
2013-09-16switch Drop to `&mut self`Daniel Micay-1/+1
2013-08-19Add externfn macro and correctly label fixed_stack_segmentsNiko Matsakis-0/+6
2013-08-02librustc: Disallow "unsafe" for external functionsPatrick Walton-3/+3
2013-07-30std::rt: Change Thread interface to require an explicit joinBrian Anderson-4/+15
Makes it more obvious what's going on
2013-06-25Change finalize -> drop.Luqman Aden-1/+1
2013-06-01Remove all uses of `pub impl`. rs=stylePatrick Walton-2/+2
2013-05-22libstd: Rename libcore to libstd and libstd to libextra; update makefiles.Patrick Walton-0/+44
This only changes the directory names; it does not change the "real" metadata names.