about summary refs log tree commit diff
path: root/src/libstd/rt/uv
AgeCommit message (Collapse)AuthorLines
2013-08-22std: UvFileStream implements HomingIO + .home_for_io() wrapper usageJeff Olson-39/+60
2013-08-22std: writing to stdout only works when using -1 offset..Jeff Olson-1/+1
2013-08-22std: rework file io.. support [p]read,[p]write, impl seek/tell + more testsJeff Olson-32/+79
2013-08-22std: adding #[fixed_stack_segment] as needed in new uvll callsJeff Olson-0/+16
2013-08-22std: rt::io::file::FileStream fleshed out.. needs more work.. see extendedJeff Olson-23/+30
- change all uses of Path in fn args to &P - FileStream.read assumptions were wrong (libuv file io is non-positional) - the above will mean that we "own" Seek impl info .. should probably push it in UvFileDescriptor.. - needs more tests
2013-08-22std: CRUD file io bindings in uvio, fs_open()/unlink() in IoFactory + testJeff Olson-0/+167
2013-08-22std: remove fcntl const bindings + making valgrind clean w/ no owned vecsJeff Olson-142/+68
2013-08-22std: support async/threadpool & sync paths in uv_fs_* calls + add sync testJeff Olson-35/+169
2013-08-22std: add read and unlink to low-level FileDescriptor + end-to-end CRUD testJeff Olson-53/+119
2013-08-22std: working tests for low-level libuv open, write and close operationsJeff Olson-27/+126
2013-08-22std: bootstrapping libuv-based fileio in newrt... open & closeJeff Olson-14/+222
the test "touch"es a new file
2013-08-21Adjust callbacks in the libraries for the new type of extern fnsNiko Matsakis-21/+102
cc #3678
2013-08-20auto merge of #8656 : toddaaro/rust/idle-opt+cleaning, r=brsonbors-1/+1
Fixed a memory leak caused by the singleton idle callback failing to close correctly. The problem was that the close function requires running inside a callback in the event loop, but we were trying to close the idle watcher after the loop returned from run. The fix was to just call run again to process this callback. There is an additional tweak to move the initialization logic fully into bootstrap, so tasks that do not ever call run do not have problems destructing.
2013-08-20auto merge of #8631 : anasazi/rust/homing-io, r=brsonbors-332/+671
libuv handles are tied to the event loop that created them. In order to perform IO, the handle must be on the thread with its home event loop. Thus, when as task wants to do IO it must first go to the IO handle's home event loop and pin itself to the corresponding scheduler while the IO action is in flight. Once the IO action completes, the task is unpinned and either returns to its home scheduler if it is a pinned task, or otherwise stays on the current scheduler. Making new blocking IO implementations (i.e. files) thread safe is rather simple. Add a home field to the IO handle's struct in uvio and implement the HomingIO trait. Wrap every IO call in the HomingIO.home_for_io method, which will take care of the scheduling. I'm not sure if this remains thread safe in the presence of asynchronous IO at the libuv level. If we decide to do that, then this set up should be revisited.
2013-08-20Fixed a memory leak caused by the singleton idle callback failing to close ↵toddaaro-1/+1
correctly. The problem was that the close function requires running inside a callback in the event loop, but we were trying to close the idle watcher after the loop returned from run. The fix was to just call run again to process this callback. There is an additional tweak to move the initialization logic fully into bootstrap, so tasks that do not ever call run do not have problems destructing.
2013-08-20auto merge of #8566 : toddaaro/rust/idle-opt+cleaning, r=catamorphism,brsonbors-7/+96
Instead of a furious storm of idle callbacks we just have one. This is a major performance gain - around 40% on my machine for the ping pong bench. Also in this PR is a cleanup commit for the scheduler code. Was previously up as a separate PR, but bors load + imminent merge hell led me to roll them together. Was #8549.
2013-08-19Make IO thread-safe.Eric Reed-651/+648
Each IO handle has a home event loop, which created it. When a task wants to use an IO handle, it must first make sure it is on that home event loop. It uses the scheduler handle in the IO handle to send itself there before starting the IO action. Once the IO action completes, the task restores its previous home state. If it is an AnySched task, then it will be executed on the new scheduler. If it has a normal home, then it will return there before executing any more code after the IO action.
2013-08-19Homed UDP socketsEric Reed-23/+212
2013-08-19Working homing UDP socket prototype.Eric Reed-1/+151
2013-08-19Instruct event loops to ignore SIGPIPE when constructed.Eric Reed-0/+1
libuv does not always catch SIGPIPE.
2013-08-19Do not execute the callback before cleaning up resources.Eric Reed-2/+4
2013-08-19clean whitespace :/toddaaro-3/+3
2013-08-19Add externfn macro and correctly label fixed_stack_segmentsNiko Matsakis-0/+168
2013-08-18auto merge of #8551 : huonw/rust/speling, r=alexcrichtonbors-2/+2
(This doesn't add/remove `u`s or change `ize` to `ise`, or anything like that.)
2013-08-16Moved the logic for a pausible idle callback into a new type - ↵toddaaro-18/+72
PausibleIdleCallback and placed the appropriate signatures in rtio and implementation into uvio.
2013-08-16std::rt: Fix a race in UvRemoteCallback's dtor that misses callbacksBrian Anderson-7/+28
Full description in comments.
2013-08-16an attempt at a singleton pausible idle callback for each scheduler. suffers ↵toddaaro-0/+14
from nondeterministic deadlock and also pending scheduler messages on scheduler shutdown.
2013-08-16doc: convert remaining uses of core:: to std::.Huon Wilson-1/+1
2013-08-16doc: correct spelling in documentation.Huon Wilson-1/+1
2013-08-15Add ToCStr method .with_c_str()Kevin Ballard-4/+4
.with_c_str() is a replacement for the old .as_c_str(), to avoid unnecessary boilerplate. Replace all usages of .to_c_str().with_ref() with .with_c_str().
2013-08-12Forbid pub/priv where it has no effectAlex Crichton-6/+6
Closes #5495
2013-08-09auto merge of #8296 : erickt/rust/remove-str-trailing-nulls, r=ericktbors-15/+16
This PR fixes #7235 and #3371, which removes trailing nulls from `str` types. Instead, it replaces the creation of c strings with a new type, `std::c_str::CString`, which wraps a malloced byte array, and respects: * No interior nulls * Ends with a trailing null
2013-08-09Merge remote-tracking branch 'remotes/origin/master' into ↵Erick Tryzelaar-70/+2
remove-str-trailing-nulls
2013-08-09Remove the C++ runtime. SayonaraBrian Anderson-9/+0
2013-08-06Merge remote-tracking branch 'remotes/origin/master' into ↵Erick Tryzelaar-4/+4
remove-str-trailing-nulls
2013-08-06Use FromStr for IpAddr in rt::uv::netStepan Koltsov-70/+2
2013-08-05Updated std::Option, std::Either and std::ResultMarvin Löbel-4/+4
- Made naming schemes consistent between Option, Result and Either - Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None) - Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
2013-08-04Merge remote-tracking branch 'remotes/origin/master' into str-remove-nullErick Tryzelaar-107/+85
2013-08-04std: replace str::as_c_str with std::c_strErick Tryzelaar-15/+16
2013-08-04auto merge of #8243 : stepancheg/rust/ipv, r=brsonbors-98/+76
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-03remove obsolete `foreach` keywordDaniel Micay-9/+9
this has been replaced by `for`
2013-08-03Rename IpAddr -> SocketAddr, extract IpAddr from SocketAddrStepan Koltsov-98/+76
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-02replace `range` with an external iteratorDaniel Micay-6/+6
2013-08-01fixed incorrect handling of returned scheduler option and restructed ↵toddaaro-1/+1
scheduler functions slightly
2013-08-01minor tweaks - unboxed the coroutine so that it is no longer a ~ pointer ↵toddaaro-3/+1
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-01A major refactoring that changes the way the runtime uses TLS. In thetoddaaro-26/+19
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-01migrate many `for` loops to `foreach`Daniel Micay-4/+5
2013-07-30std::rt: Change Thread interface to require an explicit joinBrian Anderson-6/+12
Makes it more obvious what's going on
2013-07-27Change concurrency primitives to standard naming conventionsSteven Stewart-Gallus-2/+2
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-25libstd: Implement some missing udp methods.Luqman Aden-13/+124