mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-22 00:00:11 +02:00
Refactor threadpool task types (#300)
Replaces homegrown Arc with std Arc Is this safer? Unknown. At least we don't have to maintain an arc implementation anymore. This will also make it easier to filter out tsan false positives. Also split task/mod.rs into multiple files.
This commit is contained in:
@@ -181,7 +181,7 @@ impl Pool {
|
||||
///
|
||||
/// Called from either inside or outside of the scheduler. If currently on
|
||||
/// the scheduler, then a fast path is taken.
|
||||
pub fn submit(&self, task: Task, inner: &Arc<Pool>) {
|
||||
pub fn submit(&self, task: Arc<Task>, inner: &Arc<Pool>) {
|
||||
Worker::with_current(|worker| {
|
||||
match worker {
|
||||
Some(worker) => {
|
||||
@@ -203,7 +203,7 @@ impl Pool {
|
||||
///
|
||||
/// Called from outside of the scheduler, this function is how new tasks
|
||||
/// enter the system.
|
||||
fn submit_external(&self, task: Task, inner: &Arc<Pool>) {
|
||||
fn submit_external(&self, task: Arc<Task>, inner: &Arc<Pool>) {
|
||||
use worker::Lifecycle::Notified;
|
||||
|
||||
// First try to get a handle to a sleeping worker. This ensures that
|
||||
@@ -227,7 +227,7 @@ impl Pool {
|
||||
|
||||
fn submit_to_external(&self,
|
||||
idx: usize,
|
||||
task: Task,
|
||||
task: Arc<Task>,
|
||||
state: worker::State,
|
||||
inner: &Arc<Pool>)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user