aboutsummaryrefslogtreecommitdiff
path: root/examples/cfg-whole-task.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-10-23 20:52:58 +0000
committerGitHub <noreply@github.com>2020-10-23 20:52:58 +0000
commitbbcae14e37c5f4ab5701b2a688bee52bfa7aaa1b (patch)
treec70a80e9bcacb54838f09141bd1d2b27e844760f /examples/cfg-whole-task.rs
parentb3aa9e99a975eca637582f31de20fe11ae8f7d64 (diff)
parente8eca4be37a2fe1af25b203ace5e99b31fcc3972 (diff)
Merge #399
399: Now all locks are symmetric r=AfoHT a=korken89 Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
Diffstat (limited to 'examples/cfg-whole-task.rs')
-rw-r--r--examples/cfg-whole-task.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/cfg-whole-task.rs b/examples/cfg-whole-task.rs
index 7a7fc48..e225da3 100644
--- a/examples/cfg-whole-task.rs
+++ b/examples/cfg-whole-task.rs
@@ -41,12 +41,12 @@ mod app {
}
#[task(capacity = 2, resources = [count])]
- fn foo(_cx: foo::Context) {
+ fn foo(mut _cx: foo::Context) {
#[cfg(debug_assertions)]
{
- *_cx.resources.count += 1;
+ _cx.resources.count.lock(|count| *count += 1);
- log::spawn(*_cx.resources.count).unwrap();
+ log::spawn(_cx.resources.count.lock(|count| *count)).unwrap();
}
// this wouldn't compile in `release` mode
@@ -59,12 +59,12 @@ mod app {
// currently still present in the Tasks enum
#[cfg(never)]
#[task(capacity = 2, resources = [count])]
- fn foo2(_cx: foo2::Context) {
+ fn foo2(mut _cx: foo2::Context) {
#[cfg(debug_assertions)]
{
- *_cx.resources.count += 10;
+ _cx.resources.count.lock(|count| *count += 10);
- log::spawn(*_cx.resources.count).unwrap();
+ log::spawn(_cx.resources.count.lock(|count| *count)).unwrap();
}
// this wouldn't compile in `release` mode