Hoist read lock

This commit is contained in:
Greg Fitzgerald 2018-09-07 11:54:04 -06:00
parent d5f60b68e4
commit da423b6cf0
2 changed files with 6 additions and 7 deletions

View File

@ -43,7 +43,10 @@ fn broadcast(
let blobs_chunked = blobs_vec.chunks(WINDOW_SIZE as usize).map(|x| x.to_vec());
if log_enabled!(Level::Trace) {
trace!("{}", window::print_window(&id, window, *receive_index));
trace!(
"{}",
window::print_window(&id, &window.read().unwrap(), *receive_index)
);
}
for mut blobs in blobs_chunked {

View File

@ -465,7 +465,7 @@ fn recv_window(
);
}
if log_enabled!(Level::Trace) {
trace!("{}", print_window(id, window, *consumed));
trace!("{}", print_window(id, &window.read().unwrap(), *consumed));
trace!(
"{}: consumed: {} received: {} sending consume.len: {} pixs: {:?} took {} ms",
id,
@ -483,10 +483,8 @@ fn recv_window(
Ok(())
}
pub fn print_window(id: &Pubkey, window: &SharedWindow, consumed: u64) -> String {
pub fn print_window(id: &Pubkey, window: &Window, consumed: u64) -> String {
let pointer: Vec<_> = window
.read()
.unwrap()
.iter()
.enumerate()
.map(|(i, _v)| {
@ -499,8 +497,6 @@ pub fn print_window(id: &Pubkey, window: &SharedWindow, consumed: u64) -> String
.collect();
let buf: Vec<_> = window
.read()
.unwrap()
.iter()
.map(|v| {
if v.data.is_none() && v.coding.is_none() {