diff options
Diffstat (limited to 'tokio/src/runtime/thread_pool/owned.rs')
-rw-r--r-- | tokio/src/runtime/thread_pool/owned.rs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/tokio/src/runtime/thread_pool/owned.rs b/tokio/src/runtime/thread_pool/owned.rs index 88284d5e..b60eb7f3 100644 --- a/tokio/src/runtime/thread_pool/owned.rs +++ b/tokio/src/runtime/thread_pool/owned.rs @@ -7,7 +7,7 @@ use std::cell::Cell; /// Per-worker data accessible only by the thread driving the worker. #[derive(Debug)] -pub(super) struct Owned<P: 'static> { +pub(super) struct Owned { /// Worker generation. This guards concurrent access to the `Owned` struct. /// When a worker starts running, it checks that the generation it has /// assigned matches the current generation. When it does, the worker has @@ -36,17 +36,14 @@ pub(super) struct Owned<P: 'static> { pub(super) rand: FastRand, /// Work queue - pub(super) work_queue: queue::Worker<Shared<P>>, + pub(super) work_queue: queue::Worker<Shared>, /// List of tasks owned by the worker - pub(super) owned_tasks: task::OwnedList<Shared<P>>, + pub(super) owned_tasks: task::OwnedList<Shared>, } -impl<P> Owned<P> -where - P: 'static, -{ - pub(super) fn new(work_queue: queue::Worker<Shared<P>>, rand: FastRand) -> Owned<P> { +impl Owned { + pub(super) fn new(work_queue: queue::Worker<Shared>, rand: FastRand) -> Owned { Owned { generation: AtomicUsize::new(0), tick: Cell::new(1), @@ -61,7 +58,7 @@ where } /// Returns `true` if a worker should be notified - pub(super) fn submit_local(&self, task: Task<Shared<P>>) -> bool { + pub(super) fn submit_local(&self, task: Task<Shared>) -> bool { let ret = self.work_queue.push(task); if self.defer_notification.get() { @@ -72,15 +69,15 @@ where } } - pub(super) fn submit_local_yield(&self, task: Task<Shared<P>>) { + pub(super) fn submit_local_yield(&self, task: Task<Shared>) { self.work_queue.push_yield(task); } - pub(super) fn bind_task(&mut self, task: &Task<Shared<P>>) { + pub(super) fn bind_task(&mut self, task: &Task<Shared>) { self.owned_tasks.insert(task); } - pub(super) fn release_task(&mut self, task: &Task<Shared<P>>) { + pub(super) fn release_task(&mut self, task: &Task<Shared>) { self.owned_tasks.remove(task); } } |