mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-22 03:21:00 +00:00
ts/runtime: rewrite runnable loop
Previous version relied on a plain loop / match / break because I experimented different strategies. The while variant is better for the final solution.
This commit is contained in:
parent
8bab034bc8
commit
1573522520
1 changed files with 9 additions and 14 deletions
|
@ -200,21 +200,16 @@ impl Scheduler {
|
|||
reactor.react().ok()
|
||||
});
|
||||
|
||||
loop {
|
||||
match self.tasks.pop_runnable() {
|
||||
Err(_) => break,
|
||||
Ok(runnable) => {
|
||||
panic::catch_unwind(|| runnable.run()).map_err(|err| {
|
||||
gst_error!(
|
||||
RUNTIME_CAT,
|
||||
"A task has panicked within Context {}",
|
||||
self.context_name
|
||||
);
|
||||
while let Ok(runnable) = self.tasks.pop_runnable() {
|
||||
panic::catch_unwind(|| runnable.run()).map_err(|err| {
|
||||
gst_error!(
|
||||
RUNTIME_CAT,
|
||||
"A task has panicked within Context {}",
|
||||
self.context_name
|
||||
);
|
||||
|
||||
err
|
||||
})?;
|
||||
}
|
||||
}
|
||||
err
|
||||
})?;
|
||||
}
|
||||
|
||||
let mut must_awake = self.must_awake.lock().unwrap();
|
||||
|
|
Loading…
Reference in a new issue