be shared between threads safely
--> src\main.rs:26:27
|
26 | pool.write().unwrap().execute(move || {
| ^^^^^^^ `std::sync::mpsc::Sender<std::boxed::Box<(dyn threadpool::FnBox + std::marker::Send + 'static)>>` cannot be shared between threads safely
|
= help: within `threadpool::ThreadPool`, the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Sender<std::boxed::Box<(dyn threadpool::FnBox + std::marker::Send + 'static)>>`
= note: required because it appears within the type `threadpool::ThreadPool`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::sync::RwLock<threadpool::ThreadPool>`
= note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<std::sync::RwLock<threadpool::ThreadPool>>` = note: required because it appears within the type `[closure@src\main.rs:26:35: 36:6 path:std::path::PathBuf, pool:std::sync::Arc<std::sync::RwLock<threadpool::ThreadPool>>]`
Где я опять ошибся с многопоточностью?
sender можно клонить
Обсуждают сегодня