kvark / choir

Task Orchestration Framework
MIT License
52 stars 3 forks source link

Remove Sync bound #2

Closed kvark closed 2 years ago

kvark commented 2 years ago

Getting this funny error if I remove Sync:

    Checking choir v0.2.0 (/Users/kvark/Code/choir)
error[E0277]: `(dyn FnOnce() + Send + 'static)` cannot be shared between threads safely
   --> src/lib.rs:231:14
    |
231 |             .spawn(move || conductor.work_loop(&worker_clone))
    |              ^^^^^ `(dyn FnOnce() + Send + 'static)` cannot be shared between threads safely
    |
    = help: the trait `Sync` is not implemented for `(dyn FnOnce() + Send + 'static)`
    = note: required because of the requirements on the impl of `Sync` for `Unique<(dyn FnOnce() + Send + 'static)>`
    = note: required because it appears within the type `Box<(dyn FnOnce() + Send + 'static)>`
note: required because it appears within the type `Task`
   --> src/lib.rs:57:12
    |
57  | pub struct Task {
    |            ^^^^
    = note: required because of the requirements on the impl of `Send` for `Arc<Task>`
    = note: 1 redundant requirement hidden
    = note: required because of the requirements on the impl of `Send` for `Unique<Arc<Task>>`
    = note: required because it appears within the type `alloc::raw_vec::RawVec<Arc<Task>>`
    = note: required because it appears within the type `Vec<Arc<Task>>`
note: required because it appears within the type `Continuation`
   --> src/lib.rs:48:10
    |
48  | pub enum Continuation {
    |          ^^^^^^^^^^^^
    = note: required because of the requirements on the impl of `Sync` for `Mutex<Continuation>`
    = note: 1 redundant requirement hidden
    = note: required because of the requirements on the impl of `Send` for `Arc<Mutex<Continuation>>`
note: required because it appears within the type `Task`
   --> src/lib.rs:57:12
    |
57  | pub struct Task {
    |            ^^^^
    = note: required because of the requirements on the impl of `Sync` for `Injector<Task>`
note: required because it appears within the type `Conductor`
   --> src/lib.rs:76:8
    |
76  | struct Conductor {
    |        ^^^^^^^^^
    = note: required because of the requirements on the impl of `Send` for `Arc<Conductor>`
    = note: required because it appears within the type `[closure@src/lib.rs:231:20: 231:62]`
note: required by a bound in `Builder::spawn`