thread names
This commit is contained in:
parent
9f2086c772
commit
a2b92c35e1
66
src/crdt.rs
66
src/crdt.rs
|
@ -29,7 +29,7 @@ use std::io::Cursor;
|
||||||
use std::net::{SocketAddr, UdpSocket};
|
use std::net::{SocketAddr, UdpSocket};
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use std::thread::{sleep, spawn, JoinHandle};
|
use std::thread::{sleep, Builder, JoinHandle};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use streamer::{BlobReceiver, BlobSender};
|
use streamer::{BlobReceiver, BlobSender};
|
||||||
|
|
||||||
|
@ -425,18 +425,21 @@ impl Crdt {
|
||||||
blob_sender: BlobSender,
|
blob_sender: BlobSender,
|
||||||
exit: Arc<AtomicBool>,
|
exit: Arc<AtomicBool>,
|
||||||
) -> JoinHandle<()> {
|
) -> JoinHandle<()> {
|
||||||
spawn(move || loop {
|
Builder::new()
|
||||||
let _ = Self::run_gossip(&obj, &blob_sender, &blob_recycler);
|
.name("solana-gossip".to_string())
|
||||||
if exit.load(Ordering::Relaxed) {
|
.spawn(move || loop {
|
||||||
return;
|
let _ = Self::run_gossip(&obj, &blob_sender, &blob_recycler);
|
||||||
}
|
if exit.load(Ordering::Relaxed) {
|
||||||
//TODO this should be a tuned parameter
|
return;
|
||||||
sleep(
|
}
|
||||||
obj.read()
|
//TODO this should be a tuned parameter
|
||||||
.expect("'obj' read lock in pub fn gossip")
|
sleep(
|
||||||
.timeout,
|
obj.read()
|
||||||
);
|
.expect("'obj' read lock in pub fn gossip")
|
||||||
})
|
.timeout,
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
fn run_window_request(
|
fn run_window_request(
|
||||||
window: &Arc<RwLock<Vec<Option<SharedBlob>>>>,
|
window: &Arc<RwLock<Vec<Option<SharedBlob>>>>,
|
||||||
|
@ -571,24 +574,27 @@ impl Crdt {
|
||||||
response_sender: BlobSender,
|
response_sender: BlobSender,
|
||||||
exit: Arc<AtomicBool>,
|
exit: Arc<AtomicBool>,
|
||||||
) -> JoinHandle<()> {
|
) -> JoinHandle<()> {
|
||||||
spawn(move || loop {
|
Builder::new()
|
||||||
let e = Self::run_listen(
|
.name("solana-listen".to_string())
|
||||||
&obj,
|
.spawn(move || loop {
|
||||||
&window,
|
let e = Self::run_listen(
|
||||||
&blob_recycler,
|
&obj,
|
||||||
&requests_receiver,
|
&window,
|
||||||
&response_sender,
|
&blob_recycler,
|
||||||
);
|
&requests_receiver,
|
||||||
if e.is_err() {
|
&response_sender,
|
||||||
info!(
|
|
||||||
"run_listen timeout, table size: {}",
|
|
||||||
obj.read().unwrap().table.len()
|
|
||||||
);
|
);
|
||||||
}
|
if e.is_err() {
|
||||||
if exit.load(Ordering::Relaxed) {
|
info!(
|
||||||
return;
|
"run_listen timeout, table size: {}",
|
||||||
}
|
obj.read().unwrap().table.len()
|
||||||
})
|
);
|
||||||
|
}
|
||||||
|
if exit.load(Ordering::Relaxed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue