Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel work increment/decrement prevents MCU going to sleep #2098

Merged
merged 3 commits into from
Sep 10, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions kernel/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -869,8 +869,6 @@ impl<C: Chip> ProcessType for Process<'_, C> {
return false;
}

self.kernel.increment_work();

let ret = self.tasks.map_or(false, |tasks| tasks.enqueue(task));

// Make a note that we lost this callback if the enqueue function
Expand All @@ -879,6 +877,8 @@ impl<C: Chip> ProcessType for Process<'_, C> {
self.debug.map(|debug| {
debug.dropped_callback_count += 1;
});
} else {
self.kernel.increment_work();
hudson-ayers marked this conversation as resolved.
Show resolved Hide resolved
}

ret
Expand All @@ -901,8 +901,11 @@ impl<C: Chip> ProcessType for Process<'_, C> {
},
_ => true,
});
let count_after = tasks.len();
for _ in 0..count_before - count_after {
self.kernel.decrement_work();
hudson-ayers marked this conversation as resolved.
Show resolved Hide resolved
}
if config::CONFIG.trace_syscalls {
let count_after = tasks.len();
debug!(
"[{:?}] remove_pending_callbacks[{:#x}:{}] = {} callback(s) removed",
self.appid(),
Expand Down