Integrate timers with runtime. (#266)

This patch integrate the new timer implementation with the runtime by
initializing a timer per worker thread. This allows minimizing the
amount of synchronization needed for using timers.
This commit is contained in:
Carl Lerche
2018-03-30 11:50:02 -07:00
committed by GitHub
parent d4d17392fe
commit baa2502ec6
11 changed files with 455 additions and 36 deletions
+4 -4
View File
@@ -7,7 +7,7 @@ use sleep_stack::{
use shutdown_task::ShutdownTask;
use state::{State, SHUTDOWN_ON_IDLE, SHUTDOWN_NOW};
use task::Task;
use worker::Worker;
use worker::{Worker, WorkerId};
use worker_entry::WorkerEntry;
use worker_state::{
WorkerState,
@@ -189,7 +189,7 @@ impl Inner {
Worker::with_current(|worker| {
match worker {
Some(worker) => {
let idx = worker.idx;
let idx = worker.id.idx;
trace!(" -> submit internal; idx={}", idx);
@@ -236,7 +236,7 @@ impl Inner {
let entry = &self.workers[idx];
if !entry.submit_external(task, state) {
Worker::spawn(idx, inner);
Worker::spawn(WorkerId::new(idx), inner);
}
}
@@ -273,7 +273,7 @@ impl Inner {
}
WORKER_SHUTDOWN => {
trace!("signal_work -- spawn; idx={}", idx);
Worker::spawn(idx, inner);
Worker::spawn(WorkerId::new(idx), inner);
}
_ => {}
}