Commit Graph

421 Commits

Author SHA1 Message Date
Eric Holk ad292a8c73 Add xorshift to core::rand, which gave a 3x speedup for graph generation in the bfs code. Also, remove trailing white space. 2012-05-30 17:39:53 -07:00
Eric Holk 09a32aedb5 Remove warnings in std::par. 2012-05-30 17:39:53 -07:00
Eric Holk f0c345841c Added a factory version of par::mapi, which avoids the need for share_arc, and copies arcs between tasks better. 2012-05-30 17:39:53 -07:00
Eric Holk ccb54f0ce0 Move par into libstd. Closes #2441. 2012-05-30 12:03:51 -07:00
Eric Holk 6abddca18b Rewriting shared_arc to work around Issue #2444.
Sadly, this exposes another ICE when trying to use the new version with Graph500
2012-05-30 12:03:51 -07:00
Eric Holk 5e35d49a50 Moving the arc tests into arc.rs. 2012-05-29 11:30:10 -07:00
Eric Holk aa2efc05ea Adding shared_arc to hide some of the tedium of sharing an arc between tasks.
Also added some asserts and logging to trans.

Modified graph500 to use the shared_arc, but this unfortunately doesn't work due to #2444.
2012-05-29 10:43:19 -07:00
Erick Tryzelaar ed5af70a36 std: add json::to_str and json::to_json iface. 2012-05-28 12:14:41 -07:00
Benjamin Kircher 360194d282 std: Fix bitv each() method (issue 2363) 2012-05-27 22:08:48 +02:00
Brian Anderson 432c6cbde9 core: Make range follow the for loop protocol 2012-05-26 02:28:00 -07:00
Michael Sullivan 8668d06400 Get rid of many implicit copies as a preliminary to Issue #2448. 2012-05-25 16:39:35 -07:00
Brian Anderson d89b4c8c61 std: Modify arc to tolerate upcoming change to uniques 2012-05-25 16:22:29 -07:00
Brian Anderson 7c2e981381 std: Don't export get_monitor_task_gl 2012-05-25 11:03:32 -07:00
Brian Anderson 78b664fead std: More iotask cleanup 2012-05-25 11:03:31 -07:00
Brian Anderson 937ef188e3 std: Remove unused iotask field active 2012-05-25 11:03:31 -07:00
Brian Anderson 81b8e20f31 std: Rename uv::hl to uv::iotask. Additional cleanup 2012-05-25 11:03:29 -07:00
Brian Anderson 59262dfc62 std: Move spawn_high_level_loop to uv::hl 2012-05-24 22:52:51 -07:00
Brian Anderson d4db1beabf std: Separate weakening the I/O task from spawning it 2012-05-24 22:26:30 -07:00
Brian Anderson 95898b4cfc std: Simplify run_high_level_loop further 2012-05-24 22:05:31 -07:00
Brian Anderson 623acaa013 std: Remove unused args from run_high_level_loop 2012-05-24 21:50:35 -07:00
Brian Anderson 444ff687a2 std: Move loop creation into run_high_level_loop 2012-05-24 21:50:35 -07:00
Brian Anderson 2a82a9907f std: Clean up uv_global_loop 2012-05-24 21:50:33 -07:00
Brian Anderson 26ed1e91c8 std: Rename spawn_libuv_weak_task to spawn_high_level_loop 2012-05-24 21:03:30 -07:00
Brian Anderson 06ff3f8b4b std: Use more concise code in uv::hl 2012-05-24 20:31:27 -07:00
Brian Anderson 77bbd72171 std: Remove unused variables 2012-05-24 20:31:27 -07:00
Brian Anderson a8c8c8ae28 std: FIXME's and cleanups for uv 2012-05-24 16:42:16 -07:00
Eric Holk 30f8555544 Some comments giving some idea how to use these things. 2012-05-24 15:05:39 -07:00
Niko Matsakis ccd8d5573e remove dead assignments 2012-05-24 13:35:57 -07:00
Niko Matsakis 6ca6a3b80b rewrite arc to use region & expressions (also making it pass borrowck) 2012-05-24 05:19:44 -07:00
Niko Matsakis 58988c3565 changes to get std passing borrowck 2012-05-23 17:25:56 -07:00
Eric Holk 6fa1a084f7 A shareable atomically reference counted pointer wrapper.
Needs more tests to ensure safety, and probably some more work on usability too.
2012-05-23 14:58:16 -07:00
Brian Anderson 8ec467d521 std: Update timer for new kind rules 2012-05-22 22:29:17 -07:00
Jeff Olson 92e9e736fa std: high-level libuv-leverage APIs now take a hl_loop as arg (tcp/timer) 2012-05-22 22:29:17 -07:00
Jeff Olson b0b175214a std: more work on uv tests to endure valgrind's machinations against them
- change port of tcp server test in uv_ll to avoid conflict w/ test in
net::tcp
- a few places the tcp::read fn is used in test w/ a timeout.. suspend
use of the timeout from here on out.
2012-05-22 22:29:17 -07:00
Jeff Olson c7656f67ad std:: adding tcp::read fn as simple, blocking read operation, akin to write
also: read_future ala write_future .. woooooohooooooooo
2012-05-22 22:29:17 -07:00
Jeff Olson c2ae062e90 std: adding tcp::write_future for non-block tcp writes, docs cleanup 2012-05-22 22:29:17 -07:00
Jeff Olson 9b10359041 std: several minor cleanups wrt codereview.. see extended comments
* there are a few places where I was experimenting w/ using `alt` in places
where `if`/`else` would've sufficed. don't drink the koolaid!
* I had an unneeded `else` structure (the `if` branch that preceeded
concluded with a `fail` statement.. I added the `fail` later in the dev
cycle for this branch, so I forgot to remove the `else` after doing so)
* consistent wrt `prop_name: value` vs. `prop_name : value` in record decl
and initialization
* change an `alt` exp on an `ip_addr` to actually be exhaustive,
instead of using a catch-all clause
2012-05-22 22:29:17 -07:00
Jeff Olson 7de1a68217 std: add try_parse_addr and change an alt w/ ip_addr::ipv6 to avoid warning 2012-05-22 22:29:17 -07:00
Jeff Olson a40f550ed5 std: more docs and some methods for types in net::tcp 2012-05-22 22:29:17 -07:00
Jeff Olson a4b1e965e2 std: ignoring timer test that seems to be race-failing b/c valgrind
.. this test fails frequently, locally, when ran with the batch of other
global_loop tests running due to how valgrind deals with multithreading
in the test app. not sure what to do, here.
2012-05-22 22:29:17 -07:00
Jeff Olson 6c6a47bf22 std: splitting out tcp server API + tests
- we now have two interfaces for the TCP/IP server/listener workflow,
based on different user approaches surrounding how to deal with the
flow of accept a new tcp connection:

1. the "original" API closely mimics the low-level libuv API, in that we
have an on_connect_cb that the user provides *that is ran on the libuv
thread*. In this callback, the user can accept() a connection, turning it
into a tcp_socket.. of course, before accepting, they have the option
of passing it to a new task, provided they *make the cb block until
the accept is done* .. this is because, in libuv, you have to do the
uv_accept call in the span of that on_connect_cb callback that gets fired
when a new connection comes in. thems the breaks..

I wanted to just get rid of this API, because the general proposition of
users always running code on the libuv thread sounds like an invitation
for many future headaches. the API restriction to have to choose to
immediately accept a connection (and allow the user to block libuv as
needed) isn't too bad for power users who could conceive of circumstances
where they would drop an incoming TCP connection and know what they're
doing, in general.

but as a general API, I thought this was a bit cumbersome, so I ended up
devising..

2. an API that is initiated with a call to `net::tcp::new_listener()` ..
has a similar signature to `net::tcp::listen()`, except that is just
returns an object that sort of behaves like a `comm::port`. Users can
block on the `tcp_conn_port` to receive new connections, either in the
current task or in a new task, depending on which API route they take
(`net::tcp::conn_recv` or `net::tcp::conn_recv_spawn` respectively).. there
is also a `net::tcp::conn_peek` function that will do a peek on the
underlying port to see if there are pending connections.

The main difference, with this API, is that the low-level libuv glue is
going to *accept every connection attempt*, along with the overhead that
that brings. But, this is a much more hassle-free API for 95% of use
cases and will probably be the one that most users will want to reach for.
2012-05-22 22:29:17 -07:00
Jeff Olson e9c6416df6 std: splitting out tcp server API WIP 2012-05-22 22:29:17 -07:00
Jeff Olson d02b3dffa4 std: reworking how some net and libuv modules are exported in the rc
.. turns out that, without the export, the modules aren't accessible
outside of the crate, itself. I thought that, by importing some module
into another (nesting it) and exporting from that nested module (which
is, itself, exported from std.rc) that my mod would be in the build
artifact. This doesn't appear to be the case. learning is fun!
2012-05-22 22:29:17 -07:00
Jeff Olson 733881d852 std: tightening up net::tcp, server/client test done, still has races..
.. going to rework the listen() API to be non-blocking.
2012-05-22 22:29:16 -07:00
Jeff Olson a4127d3fc6 std: change sig of uv::ll::accept, again. 2012-05-22 22:29:16 -07:00
Jeff Olson 465412aeff std: first-pass at a tcp server API, with a basic (non-robust) test
also whitespace cleanup

.. for now, the test just spins up the server and listens for messages,
echoing them back to an output port. there's a "kill" msg that it will
listen for. need to point the tcp client and server test impls at each
other for a loopback server/client test, like how its done in uv::ll

once ipv6 parse/format lands, i can add another test using the entirely
same codebase, but substituting an ip_addr ipv6 varient for the ipv4
varient used in the existing code

still need some other plumbing to get the client/server tests to work
together.
2012-05-22 22:29:16 -07:00
Jeff Olson f2fd3bcf17 std: FIXME stub net::ip::ip_addr::ipv6 variant...needs parse/format impl
still need implementation for parsing/output formatting and (perhaps?)
representation (for now, i just followef the ipv4 variant's lead and
am representing it as a tuple of 8x u16).

parsing an ipv6 addr is way more complex than parsing an ipv4 addr, so
i'm putting off an implementation here, for now.

candidate solutions:
- could use getaddrinfo() (exists on both POSIX and windows), but with
incompatible fn signatures.
- libuv has a way to parse an ipv6 string into
a sockaddr_in6, but it also requires a port, so it's probably not aprop
for ip_addr
2012-05-22 22:29:16 -07:00
Jeff Olson 64048d43d6 std: makeing uv::ll::listen/accept use generic params for ptr args
more flexibility..
2012-05-22 22:29:16 -07:00
Jeff Olson 83cca50240 std: change tcp_*_result to use result::result.. flatter! 2012-05-22 22:29:16 -07:00
Jeff Olson 3d8f7d644b std: no longer return uv::ll::err_data records from net::tcp
they're changed into a net::tcp::tcp_err_data record, for now. once the
scope of possible tcp errors, from libuv, is established ill create an
err type for each one and return those where they might occur
2012-05-22 22:29:16 -07:00