-
Notifications
You must be signed in to change notification settings - Fork 12
Description
This crate shows some great promise! I love the idea of providing a rayon compatibility layer! Makes it so much easier to experiment.
I tried it in the Wild linker using the rayon-compat crate. It wasn't a drop-in replacement for rayon, but was close enough. I was able to link a trivial program and it showed a good performance improvement. I'd love to see how it performs when linking larger programs, but unfortunately I seem to hit a deadlock where a scope appears to not shut down despite not having any active work.
I've since tried using forte directly from a small test program and the following code failed to terminate:
use forte::ThreadPool;
static THREAD_POOL: ThreadPool = ThreadPool::new();
fn main() {
THREAD_POOL.resize_to(2);
THREAD_POOL.resize_to(0);
}Running cargo test at head also seems to result in some deadlocks. e.g. thread_pool::tests::join_basic seems to deadlock. This looks to be the same deadlock as in the example code above.
It seems like the main thread is waiting for the heartbeat thread to shut down while holding a lock and the heartbeat thread is waiting for the lock. I tried fixing this by dropping the mutex guard before trying to join the heartbeat thread, but then hit a different deadlock waiting for the worker threads to shut down. Possibly related to this commented-out line.
I'm not sure if the deadlock I see when using this crate in the wild linker is the same or different to either of the above.