1
0
Fork 0

Fix reference counts for background worker threads

We would decrement this on drop, but never increment it on clone. Oops.
This commit is contained in:
Robbert van der Helm 2023-02-23 21:29:58 +01:00
parent 5d9affad17
commit 4564bf9027

View file

@ -83,6 +83,8 @@ lazy_static::lazy_static! {
impl<T, E> Clone for WorkerThreadHandle<T, E> { impl<T, E> Clone for WorkerThreadHandle<T, E> {
fn clone(&self) -> Self { fn clone(&self) -> Self {
self.reference_count.fetch_add(1, Ordering::SeqCst);
Self { Self {
tasks_sender: self.tasks_sender.clone(), tasks_sender: self.tasks_sender.clone(),
reference_count: self.reference_count.clone(), reference_count: self.reference_count.clone(),