summary refs log tree commit diff
path: root/src/libstd/rt
AgeCommit message (Collapse)AuthorLines
2013-08-04std: minor cleanupErick Tryzelaar-3/+3
2013-08-04auto merge of #8243 : stepancheg/rust/ipv, r=brsonbors-148/+142
multicast functions now take IpAddr (without port), because they dont't need port. Uv* types renamed: * UvIpAddr -> UvSocketAddr * UvIpv4 -> UvIpv4SocketAddr * UvIpv6 -> UvIpv6SocketAddr "Socket address" is a common name for (ip-address, port) pair (e.g. in sockaddr_in struct). P. S. Are there any backward compatibility concerns? What is std::rt module, is it a part of public API?
2013-08-03auto merge of #8264 : thestinger/rust/snapshot, r=Aatchbors-31/+31
2013-08-03remove obsolete `foreach` keywordDaniel Micay-31/+31
this has been replaced by `for`
2013-08-03std::rt: Run local storage cleanup and the box annihilator inside the try/catchBrian Anderson-27/+22
And before collect_failure. These are both running user dtors and need to be handled in the task try/catch block and before the final task cleanup code.
2013-08-03auto merge of #8213 : kballard/rust/fd-limit, r=brsonbors-4/+83
Revert the workaround 49b72bd and instead bump the fd limit on OS X.
2013-08-02librustc: Disallow "unsafe" for external functionsPatrick Walton-4/+4
2013-08-02Bump fd limit on macos when running rt testsKevin Ballard-0/+78
OS X defaults the ulimit for open files to 256 for programs launched from the Terminal (GUI apps get a higher default). Unfortunately this is too low for the rt tests, which deliberately overcommit and create a lot of threads (which means a lot of schedulers, and each scheduler needs at least 2 fds). By calling sysctl() and setrlimit() we can bump the fd limit up to the maximum allowed (on stock OS X it's 10240). Fixes #7772.
2013-08-02Revert "std::rt: Use a constant 4 threads for multithreaded sched tests"Kevin Ballard-4/+5
This workaround was less than ideal. A better solution is to raise the fd limit. This reverts commit 49b72bdd77916e27aaf95909516702c1450f11ac.
2013-08-03Rename IpAddr -> SocketAddr, extract IpAddr from SocketAddrStepan Koltsov-148/+142
multicast functions now take IpAddr (without port), because they dont't need port. Uv* types renamed: * UvIpAddr -> UvSocketAddr * UvIpv4 -> UvIpv4SocketAddr * UvIpv6 -> UvIpv6SocketAddr "Socket address" is a common name for (ip-address, port) pair (e.g. in sockaddr_in struct).
2013-08-02Add an assert_may_sleep() check on every context switch.Ben Blum-0/+4
2013-08-02Don't fail from kill signals if already unwinding.Ben Blum-3/+3
2013-08-02Fix embarrassing bug where 'unkillable' would unwind improperly when it ↵Ben Blum-2/+3
receives a kill signal.
2013-08-02Fix nasty double-free bug where a newrt chan could get killed after ↵Ben Blum-2/+7
rescheduling but before suppressing_finalize.
2013-08-02Add SendDeferred trait and use it to fix #8214.Ben Blum-24/+127
2013-08-02auto merge of #8221 : brson/rust/single-threaded, r=graydonbors-3/+9
This is the last major runtime feature needed for the transition to the new scheduler.
2013-08-02auto merge of #8195 : bblum/rust/task-cleanup, r=brsonbors-23/+90
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.
2013-08-02std: Implement SingleThreaded spawn mode for newschedBrian Anderson-3/+9
2013-08-02replace `range` with an external iteratorDaniel Micay-25/+23
2013-08-01modified local to include an implementation for try_unsafe_borrow::<Task> so ↵toddaaro-4/+11
that the log methods will work
2013-08-01fixed incorrect handling of returned scheduler option and restructed ↵toddaaro-75/+64
scheduler functions slightly
2013-08-01minor tweaks - unboxed the coroutine so that it is no longer a ~ pointer ↵toddaaro-32/+72
inside the task struct, and also added an assert to verify that send is never called inside scheduler context as it is undefined (BROKEN) if that happens
2013-08-01Fixed a race where a scheduler configured to only run tasks pinned to it ↵toddaaro-8/+35
would "bounch" a regular task in and out of the work queue without allowing a different scheduler to run it.
2013-08-01A major refactoring that changes the way the runtime uses TLS. In thetoddaaro-987/+867
old design the TLS held the scheduler struct, and the scheduler struct held the active task. This posed all sorts of weird problems due to how we wanted to use the contents of TLS. The cleaner approach is to leave the active task in TLS and have the task hold the scheduler. To make this work out the scheduler has to run inside a regular task, and then once that is the case the context switching code is massively simplified, as instead of three possible paths there is only one. The logical flow is also easier to follow, as the scheduler struct acts somewhat like a "token" indicating what is active. These changes also necessitated changing a large number of runtime tests, and rewriting most of the runtime testing helpers. Polish level is "low", as I will very soon start on more scheduler changes that will require wiping the polish off. That being said there should be sufficient comments around anything complex to make this entirely respectable as a standalone commit.
2013-08-01Temporary workaround to prevent taskgroup cleanup code from failing without ↵Ben Blum-3/+13
an exception handler.
2013-08-01Make a forgotten assert in comm be cfg(test)-dependentBen Blum-3/+1
2013-08-01Document task killing design and relaxed barrier rationale.Ben Blum-1/+57
2013-08-01Relax some atomic barriers. Loosen up all that tension. There, doesn't that ↵Ben Blum-16/+19
feel good?
2013-08-01migrate to foreachDaniel Micay-2/+2
2013-08-01std: Change `Times` trait to use `do` instead of `for`blake2-ppc-27/+27
Change the former repetition:: for 5.times { } to:: do 5.times { } .times() cannot be broken with `break` or `return` anymore; for those cases, use a numerical range loop instead.
2013-08-01auto merge of #8158 : bblum/rust/task-cleanup, r=brsonbors-4/+10
r? @brson
2013-08-01migrate many `for` loops to `foreach`Daniel Micay-17/+18
2013-08-01make `in` and `foreach` get treated as keywordsDaniel Micay-14/+14
2013-07-31Move atomically to unstable::sync, and document what it actually does. Close ↵Ben Blum-1/+1
#7872.
2013-07-31Give tasks useful names. #2891Ben Blum-3/+9
2013-07-31auto merge of #8139 : brson/rust/rm-old-task-apis, r=pcwaltonbors-26/+55
This removes a bunch of options from the task builder interface that are irrelevant to the new scheduler and were generally unused anyway. It also bumps the stack size of new scheduler tasks so that there's enough room to run rustc and changes the interface to `Thread` to not implicitly join threads on destruction, but instead require an explicit, and mandatory, call to `join`.
2013-07-30auto merge of #8008 : bblum/rust/select, r=brsonbors-100/+557
Main logic in ```Implement select() for new runtime pipes.```. The guts of the ```PortOne::try_recv()``` implementation are now split up across several functions, ```optimistic_check```, ```block_on```, and ```recv_ready```. There is one weird FIXME I left open here, in the "implement select" commit -- an assertion I couldn't get to work in the receive path, on an invariant that for some reason doesn't hold with ```SharedPort```. Still investigating this.
2013-07-30std::rt: Change Thread interface to require an explicit joinBrian Anderson-25/+54
Makes it more obvious what's going on
2013-07-30std::rt: Use 2MB stacksBrian Anderson-1/+1
Seems to be around the minimum needed by rustc without split stacks
2013-07-30UnsafeArc methods return unsafe pointers, so are not themselves unsafe.Ben Blum-10/+10
2013-07-30Unkillable is not unsafe. Close #7832.Ben Blum-23/+21
2013-07-30Add a better-for-testing optimistic_check() for pipes with cfg(test).Ben Blum-1/+15
2013-07-30Add test cases for selectBen Blum-0/+228
2013-07-30Implement select() for new runtime pipes.Ben Blum-35/+269
2013-07-30implement pointer arithmetic with GEPDaniel Micay-2/+2
Closes #8118, #7136 ~~~rust extern mod extra; use std::vec; use std::ptr; fn bench_from_elem(b: &mut extra::test::BenchHarness) { do b.iter { let v: ~[u8] = vec::from_elem(1024, 0u8); } } fn bench_set_memory(b: &mut extra::test::BenchHarness) { do b.iter { let mut v: ~[u8] = vec::with_capacity(1024); unsafe { let vp = vec::raw::to_mut_ptr(v); ptr::set_memory(vp, 0, 1024); vec::raw::set_len(&mut v, 1024); } } } fn bench_vec_repeat(b: &mut extra::test::BenchHarness) { do b.iter { let v: ~[u8] = ~[0u8, ..1024]; } } ~~~ Before: test bench_from_elem ... bench: 415 ns/iter (+/- 17) test bench_set_memory ... bench: 85 ns/iter (+/- 4) test bench_vec_repeat ... bench: 83 ns/iter (+/- 3) After: test bench_from_elem ... bench: 84 ns/iter (+/- 2) test bench_set_memory ... bench: 84 ns/iter (+/- 5) test bench_vec_repeat ... bench: 84 ns/iter (+/- 3)
2013-07-29Optimize try_recv to not require the two context switches when data is ↵Ben Blum-31/+34
available.
2013-07-29Remove ChanOneHack/PortOneHack extra allocationBen Blum-50/+30
2013-07-27Change concurrency primitives to standard naming conventionsSteven Stewart-Gallus-10/+10
To be more specific: `UPPERCASETYPE` was changed to `UppercaseType` `type_new` was changed to `Type::new` `type_function(value)` was changed to `value.method()`
2013-07-27auto merge of #8076 : omasanori/rust/cleanup, r=huonwbors-2/+0
A cleanup suggested on #7922.
2013-07-27auto merge of #7864 : brson/rust/start-on-main-thread, r=brsonbors-10/+61
Applications that need to use the GUI can override start and set up the runtime using this function.