From d2e337f75edc0fed5e5ec4a06bdc68f7fcd08bfd Mon Sep 17 00:00:00 2001 From: porcuquine Date: Sat, 10 Oct 2020 03:36:03 +0000 Subject: [PATCH] Hold cleanup handle in producer threads. --- .../porep/src/stacked/vanilla/create_label/multi.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/storage-proofs/porep/src/stacked/vanilla/create_label/multi.rs b/storage-proofs/porep/src/stacked/vanilla/create_label/multi.rs index 4606601aad..b11e07898b 100644 --- a/storage-proofs/porep/src/stacked/vanilla/create_label/multi.rs +++ b/storage-proofs/porep/src/stacked/vanilla/create_label/multi.rs @@ -260,9 +260,8 @@ fn create_layer_labels( // This could fail, but we will ignore the error if so. // It will be logged as a warning by `bind_core`. debug!("binding core in producer thread {}", i); - if let Some(&core_index) = core_index { - let _ = bind_core(core_index); - } + // When `_cleanup_handle` is dropped, the previous binding of thread will be restored. + let _cleanup_handle = core_index.map(|c| bind_core(*c)); create_label_runner( parents_cache,