summary refs log tree commit diff
path: root/src/librustuv/timer.rs
AgeCommit message (Collapse)AuthorLines
2014-03-13std: Rename Chan/Port types and constructorAlex Crichton-10/+10
* Chan<T> => Sender<T> * Port<T> => Receiver<T> * Chan::new() => channel() * constructor returns (Sender, Receiver) instead of (Receiver, Sender) * local variables named `port` renamed to `rx` * local variables named `chan` renamed to `tx` Closes #11765
2014-02-12Expose whether event loops have active I/OAlex Crichton-13/+13
The green scheduler can optimize its runtime based on this by deciding to not go to sleep in epoll() if there is no active I/O and there is a task to be stolen. This is implemented for librustuv by keeping a count of the number of tasks which are currently homed. If a task is homed, and then performs a blocking I/O operation, the count will be nonzero while the task is blocked. The homing count is intentionally 0 when there are I/O handles, but no handles currently blocked. The reason for this is that epoll() would only be used to wake up the scheduler anyway. The crux of this change was to have a `HomingMissile` contain a mutable borrowed reference back to the `HomeHandle`. The rest of the change was just dealing with this fallout. This reference is used to decrement the homed handle count in a HomingMissile's destructor. Also note that the count maintained is not atomic because all of its increments/decrements/reads are all on the same I/O thread.
2014-02-11Move replace and swap to std::mem. Get rid of std::utilEdward Wang-4/+4
Also move Void to std::any, move drop to std::mem and reexport in prelude.
2014-02-03std: Remove try_send_deferred plus all falloutAlex Crichton-1/+1
Now that extra::sync primitives are built on a proper mutex instead of a pthreads one, there's no longer any use for this function.
2014-02-03rustuv: Require all results are used and fix falloutAlex Crichton-9/+9
2014-01-29Remove do keyword from librustuvScott Lawrence-6/+6
2013-12-25Test fixes and rebase conflictsAlex Crichton-1/+1
* 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: Remove must deferred sending functionsAlex Crichton-2/+2
These functions are all unnecessary now, and they only have meaning in the M:N context. Removing these functions uncovered a bug in the librustuv timer bindings, but it was fairly easy to cover (and the test is already committed). These cannot be completely removed just yet due to their usage in the WaitQueue of extra::sync, and until the mutex in libextra is rewritten it will not be possible to remove the deferred sends for channels.
2013-12-24green: Fixing all tests from previous refactoringsAlex Crichton-3/+3
2013-12-24rustuv: Get all tests passing again after refactorAlex Crichton-0/+1
All tests except for the homing tests are now working again with the librustuv/libgreen refactoring. The homing-related tests are currently commented out and now placed in the rustuv::homing module. I plan on refactoring scheduler pool spawning in order to enable more homing tests in a future commit.
2013-12-24rustuv: Reimplement without using std::rt::schedAlex Crichton-14/+13
This reimplements librustuv without using the interfaces provided by the scheduler in libstd. This solely uses the new Runtime trait in order to interface with the local task and perform the necessary scheduling operations. The largest snag in this refactoring is reimplementing homing. The new runtime trait exposes no concept of "homing" a task or forcibly sending a task to a remote scheduler (there is no concept of a scheduler). In order to reimplement homing, the transferrence of tasks is now done at the librustuv level instead of the scheduler level. This means that all I/O loops now have a concurrent queue which receives homing messages and requests. This allows the entire implementation of librustuv to be only dependent on the runtime trait, severing all dependence of librustuv on the scheduler and related green-thread functions. This is all in preparation of the introduction of libgreen and libnative. At the same time, I also took the liberty of removing all glob imports from librustuv.
2013-12-16Test fallout from std::comm rewriteAlex Crichton-13/+29
2013-12-16Fallout of rewriting std::commAlex Crichton-5/+4
2013-12-10libextra: Another round of de-`Cell`-ing.Patrick Walton-7/+6
34 uses of `Cell` remain.
2013-12-03Move std::util::ignore to std::prelude::dropSteven Fackler-2/+2
It's a more fitting name for the most common use case of this function.
2013-11-26librustuv: Remove all non-`proc` uses of `do` from `libextra` andPatrick Walton-2/+2
`librustuv`.
2013-11-10Fix usage of libuv for windowsAlex Crichton-3/+30
2013-11-10Carefully destroy channels at the right time.Alex Crichton-9/+41
When a channel is destroyed, it may attempt scheduler operations which could move a task off of it's I/O scheduler. This is obviously a bad interaction, and some finesse is required to make it work (making destructors run at the right time). Closes #10375
2013-11-10Another round of test fixes from previous commitsAlex Crichton-2/+76
2013-11-10Make the uv bindings resilient to linked failureAlex Crichton-32/+29
In the ideal world, uv I/O could be canceled safely at any time. In reality, however, we are unable to do this. Right now linked failure is fairly flaky as implemented in the runtime, making it very difficult to test whether the linked failure mechanisms inside of the uv bindings are ready for this kind of interaction. Right now, all constructors will execute in a task::unkillable block, and all homing I/O operations will prevent linked failure in the duration of the homing operation. What this means is that tasks which perform I/O are still susceptible to linked failure, but the I/O operations themselves will never get interrupted. Instead, the linked failure will be received at the edge of the I/O operation.
2013-11-10Assorted test fixes and merge conflictsAlex Crichton-4/+4
2013-11-10Update all uv tests to pass againAlex Crichton-75/+35
2013-11-10Clean up the remaining chunks of uvAlex Crichton-2/+2
2013-11-10Migrate uv net bindings away from ~fn()Alex Crichton-5/+2
2013-11-10Migrate uv file bindings away from ~fn()Alex Crichton-3/+3
2013-11-10Fixing rebase conflicts and suchAlex Crichton-22/+18
This cleans up the merging of removing ~fn() and removing C++ wrappers to a compile-able and progress-ready state
2013-11-10Migrate uv signal handling away from ~fn()Alex Crichton-2/+1
2013-11-10Migrate uv process bindings away from ~fn()Alex Crichton-3/+3
2013-11-10Migrate uv timer bindings away from ~fn()Alex Crichton-33/+98
2013-11-10uv: Remove lots of uv/C++ wrappersAlex Crichton-3/+3
2013-10-29Move rust's uv implementation to its own crateAlex Crichton-0/+157
There are a few reasons that this is a desirable move to take: 1. Proof of concept that a third party event loop is possible 2. Clear separation of responsibility between rt::io and the uv-backend 3. Enforce in the future that the event loop is "pluggable" and replacable Here's a quick summary of the points of this pull request which make this possible: * Two new lang items were introduced: event_loop, and event_loop_factory. The idea of a "factory" is to define a function which can be called with no arguments and will return the new event loop as a trait object. This factory is emitted to the crate map when building an executable. The factory doesn't have to exist, and when it doesn't then an empty slot is in the crate map and a basic event loop with no I/O support is provided to the runtime. * When building an executable, then the rustuv crate will be linked by default (providing a default implementation of the event loop) via a similar method to injecting a dependency on libstd. This is currently the only location where the rustuv crate is ever linked. * There is a new #[no_uv] attribute (implied by #[no_std]) which denies implicitly linking to rustuv by default Closes #5019