Skip to content

Commit

Permalink
Fix extreme amount of syscalls to give time share to OS
Browse files Browse the repository at this point in the history
  • Loading branch information
vertexclique committed Dec 31, 2019
1 parent c0f555c commit 1a3580a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/discord.yml

This file was deleted.

25 changes: 16 additions & 9 deletions bastion/src/bastion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ use crate::message::{BastionMessage, Message};
use crate::path::BastionPathElement;
use crate::supervisor::{Supervisor, SupervisorRef};
use crate::system::SYSTEM;
use bastion_executor::run::run;
use core::future::Future;
use lightproc::proc_stack::ProcStack;
use std::fmt::{self, Debug, Formatter};
use std::thread;

Expand Down Expand Up @@ -564,16 +566,21 @@ impl Bastion {
/// [`Bastion::kill()`]: #method.kill
pub fn block_until_stopped() {
debug!("Bastion: Blocking until system is stopped.");
loop {
// FIXME: panics
let system = SYSTEM.handle().lock().wait().unwrap();
if system.is_none() {
debug!("Bastion: Unblocking because system is stopped.");
return;
}
run(
async {
loop {
// FIXME: panics
let system = SYSTEM.handle().lock().wait().unwrap();
if system.is_none() {
debug!("Bastion: Unblocking because system is stopped.");
return;
}

thread::yield_now();
}
// thread::yield_now();
}
},
ProcStack::default(),
)
}
}

Expand Down

0 comments on commit 1a3580a

Please sign in to comment.