Skip to content

Commit

Permalink
Android HotFix
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnnyFFM committed Jan 13, 2019
1 parent da63413 commit 1409dae
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ pub struct CpuBuffer {
}

impl CpuBuffer {
pub fn new(buffer_size: usize) -> Self {
pub fn new(buffer_size: usize) -> Self {
let pointer = aligned_alloc::aligned_alloc(buffer_size, page_size::get());
let data: Vec<u8>;
unsafe {
unsafe {
data = Vec::from_raw_parts(pointer as *mut u8, buffer_size, buffer_size);
}
CpuBuffer {
Expand Down Expand Up @@ -186,12 +186,17 @@ impl Miner {
cfg.benchmark_only.to_uppercase() == "XPU",
);

let core_ids = core_affinity::get_core_ids().unwrap();
let thread_pinning = cfg.cpu_thread_pinning;
let core_ids = if thread_pinning {
core_affinity::get_core_ids().unwrap()
} else {
Vec::new()
};

let cpu_threads = if cfg.cpu_threads == 0 {
core_ids.len()
num_cpus::get()
} else {
min(cfg.cpu_threads, core_ids.len())
min(cfg.cpu_threads, num_cpus::get())
};

let cpu_worker_task_count = cfg.cpu_worker_task_count;
Expand Down

0 comments on commit 1409dae

Please sign in to comment.