Fix TuiUI deadlock under multi-threading (#1871)
Co-authored-by: Dominik Maier <domenukk@gmail.com>
This commit is contained in:
parent
ef16e645b7
commit
f48e281be8
@ -579,33 +579,27 @@ impl TuiUI {
|
||||
) where
|
||||
B: Backend,
|
||||
{
|
||||
let items = vec![
|
||||
let items = {
|
||||
let app = app.read().unwrap();
|
||||
vec![
|
||||
Row::new(vec![
|
||||
Cell::from(Span::raw("clients")),
|
||||
Cell::from(Span::raw(format!("{}", self.clients))),
|
||||
Cell::from(Span::raw("total execs")),
|
||||
Cell::from(Span::raw(format!("{}", app.read().unwrap().total_execs))),
|
||||
Cell::from(Span::raw(format!("{}", app.total_execs))),
|
||||
Cell::from(Span::raw("map density")),
|
||||
Cell::from(Span::raw(app.read().unwrap().total_map_density.to_string())),
|
||||
Cell::from(Span::raw(app.total_map_density.to_string())),
|
||||
]),
|
||||
Row::new(vec![
|
||||
Cell::from(Span::raw("solutions")),
|
||||
Cell::from(Span::raw(format!(
|
||||
"{}",
|
||||
app.read().unwrap().total_solutions
|
||||
))),
|
||||
Cell::from(Span::raw(format!("{}", app.total_solutions))),
|
||||
Cell::from(Span::raw("cycle done")),
|
||||
Cell::from(Span::raw(format!(
|
||||
"{}",
|
||||
app.read().unwrap().total_cycles_done
|
||||
))),
|
||||
Cell::from(Span::raw(format!("{}", app.total_cycles_done))),
|
||||
Cell::from(Span::raw("corpus count")),
|
||||
Cell::from(Span::raw(format!(
|
||||
"{}",
|
||||
app.read().unwrap().total_corpus_count
|
||||
))),
|
||||
Cell::from(Span::raw(format!("{}", app.total_corpus_count))),
|
||||
]),
|
||||
];
|
||||
]
|
||||
};
|
||||
|
||||
let chunks = Layout::default()
|
||||
.constraints([Constraint::Percentage(100)].as_ref())
|
||||
@ -641,14 +635,14 @@ impl TuiUI {
|
||||
) where
|
||||
B: Backend,
|
||||
{
|
||||
let items = vec![
|
||||
let items = {
|
||||
let app = app.read().unwrap();
|
||||
vec![
|
||||
Row::new(vec![
|
||||
Cell::from(Span::raw("cycles done")),
|
||||
Cell::from(Span::raw(format!(
|
||||
"{}",
|
||||
app.read()
|
||||
.unwrap()
|
||||
.clients
|
||||
app.clients
|
||||
.get(&self.clients_idx)
|
||||
.map_or(0, |x| x.cycles_done)
|
||||
))),
|
||||
@ -657,14 +651,13 @@ impl TuiUI {
|
||||
Cell::from(Span::raw("solutions")),
|
||||
Cell::from(Span::raw(format!(
|
||||
"{}",
|
||||
app.read()
|
||||
.unwrap()
|
||||
.clients
|
||||
app.clients
|
||||
.get(&self.clients_idx)
|
||||
.map_or(0, |x| x.objectives)
|
||||
))),
|
||||
]),
|
||||
];
|
||||
]
|
||||
};
|
||||
|
||||
let chunks = Layout::default()
|
||||
.constraints([Constraint::Percentage(100)].as_ref())
|
||||
@ -693,25 +686,21 @@ impl TuiUI {
|
||||
) where
|
||||
B: Backend,
|
||||
{
|
||||
let items = vec![
|
||||
let items = {
|
||||
let app = app.read().unwrap();
|
||||
vec![
|
||||
Row::new(vec![
|
||||
Cell::from(Span::raw("corpus count")),
|
||||
Cell::from(Span::raw(format!(
|
||||
"{}",
|
||||
app.read()
|
||||
.unwrap()
|
||||
.clients
|
||||
.get(&self.clients_idx)
|
||||
.map_or(0, |x| x.corpus)
|
||||
app.clients.get(&self.clients_idx).map_or(0, |x| x.corpus)
|
||||
))),
|
||||
]),
|
||||
Row::new(vec![
|
||||
Cell::from(Span::raw("total execs")),
|
||||
Cell::from(Span::raw(format!(
|
||||
"{}",
|
||||
app.read()
|
||||
.unwrap()
|
||||
.clients
|
||||
app.clients
|
||||
.get(&self.clients_idx)
|
||||
.map_or(0, |x| x.executions)
|
||||
))),
|
||||
@ -719,14 +708,13 @@ impl TuiUI {
|
||||
Row::new(vec![
|
||||
Cell::from(Span::raw("map density")),
|
||||
Cell::from(Span::raw(
|
||||
app.read()
|
||||
.unwrap()
|
||||
.clients
|
||||
app.clients
|
||||
.get(&self.clients_idx)
|
||||
.map_or("0%".to_string(), |x| x.map_density.to_string()),
|
||||
)),
|
||||
]),
|
||||
];
|
||||
]
|
||||
};
|
||||
|
||||
let chunks = Layout::default()
|
||||
.constraints([Constraint::Percentage(100)].as_ref())
|
||||
|
Loading…
x
Reference in New Issue
Block a user