Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Arc can be an Rc #1769

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ use std::convert::TryInto;
use std::marker::PhantomData;
use std::mem::{self, size_of};
use std::path::Path;
use std::rc::Rc;
use std::sync::{
atomic::{AtomicU64, Ordering::SeqCst},
Arc, MutexGuard,
MutexGuard,
};
use std::thread;
use std::time::Duration;
Expand Down Expand Up @@ -208,7 +209,7 @@ fn create_layer_labels(
exp_labels: Option<&mut MmapMut>,
num_nodes: u64,
cur_layer: u32,
core_group: Arc<Option<MutexGuard<'_, Vec<CoreIndex>>>>,
core_group: Rc<Option<MutexGuard<'_, Vec<CoreIndex>>>>,
) {
info!("Creating labels for layer {}", cur_layer);
// num_producers is the number of producer threads
Expand Down Expand Up @@ -458,7 +459,7 @@ pub fn create_labels_for_encoding<

let default_cache_size = DEGREE * 4 * cache_window_nodes;

let core_group = Arc::new(checkout_core_group());
let core_group = Rc::new(checkout_core_group());

// When `_cleanup_handle` is dropped, the previous binding of thread will be restored.
let _cleanup_handle = (*core_group).as_ref().map(|group| {
Expand Down Expand Up @@ -556,7 +557,7 @@ pub fn create_labels_for_decoding<Tree: 'static + MerkleTreeTrait, T: AsRef<[u8]

let default_cache_size = DEGREE * 4 * cache_window_nodes;

let core_group = Arc::new(checkout_core_group());
let core_group = Rc::new(checkout_core_group());

// When `_cleanup_handle` is dropped, the previous binding of thread will be restored.
let _cleanup_handle = (*core_group).as_ref().map(|group| {
Expand Down
Loading