fix (cross-core) initialization barriers

This commit is contained in:
Jorge Aparicio 2019-07-03 20:36:52 +02:00
parent be92041a59
commit 14d63f4961

View file

@ -25,8 +25,12 @@ pub fn codegen(
if analysis.timer_queues.is_empty() { if analysis.timer_queues.is_empty() {
// cross-initialization barriers -- notify *other* cores that their resources have been // cross-initialization barriers -- notify *other* cores that their resources have been
// initialized // initialized
if analysis.initialization_barriers.contains_key(&core) { for (user, initializers) in &analysis.initialization_barriers {
let ib = util::init_barrier(core); if !initializers.contains(&core) {
continue;
}
let ib = util::init_barrier(*user);
let shared = if cfg!(feature = "heterogeneous") { let shared = if cfg!(feature = "heterogeneous") {
Some(quote!( Some(quote!(
#[rtfm::export::shared] #[rtfm::export::shared]
@ -46,15 +50,13 @@ pub fn codegen(
} }
// then wait until the other cores have initialized *our* resources // then wait until the other cores have initialized *our* resources
for (&initializer, users) in &analysis.initialization_barriers { if analysis.initialization_barriers.contains_key(&core) {
if users.contains(&core) { let ib = util::init_barrier(core);
let ib = util::init_barrier(initializer);
stmts.push(quote!( stmts.push(quote!(
#ib.wait(); #ib.wait();
)); ));
} }
}
// cross-spawn barriers: wait until other cores are ready to receive messages // cross-spawn barriers: wait until other cores are ready to receive messages
for (&receiver, senders) in &analysis.spawn_barriers { for (&receiver, senders) in &analysis.spawn_barriers {