diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-02-10 19:59:35 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-02-12 09:46:31 -0800 |
| commit | cc34dbb84090f74c84037afb269003f13aa46b78 (patch) | |
| tree | 5c23a0f081b5206c2582e8064109da8ac6c5649c /src/rustllvm/ExecutionEngineWrapper.cpp | |
| parent | 1d5c52d8a1d9cc5750aadfbb707584466083ef47 (diff) | |
| download | rust-cc34dbb84090f74c84037afb269003f13aa46b78.tar.gz rust-cc34dbb84090f74c84037afb269003f13aa46b78.zip | |
Expose whether event loops have active I/O
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.
Diffstat (limited to 'src/rustllvm/ExecutionEngineWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
