aboutsummaryrefslogtreecommitdiff
path: root/src/examples/_3_preemption.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-11-03 16:31:11 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-11-03 16:31:11 +0000
commit777765e522949ebf84d05d4db075132172d81494 (patch)
tree41bc00739da8f832eb5ba68ef99ec8b9d06111a4 /src/examples/_3_preemption.rs
parent653338e7997a0cdc5deaed98b1bb5f60006717ed (diff)
parent3a867e70c3b1afc4943ec597e4f188432fba5a8b (diff)
Merge #97
97: v0.4.0 r=japaric a=japaric closes #32 closes #33 Co-authored-by: Jorge Aparicio <jorge@japaric.io>
Diffstat (limited to 'src/examples/_3_preemption.rs')
-rw-r--r--src/examples/_3_preemption.rs71
1 files changed, 0 insertions, 71 deletions
diff --git a/src/examples/_3_preemption.rs b/src/examples/_3_preemption.rs
deleted file mode 100644
index 14c9d92..0000000
--- a/src/examples/_3_preemption.rs
+++ /dev/null
@@ -1,71 +0,0 @@
-//! Two tasks running at *different* priorities with access to the same resource
-//!
-//! ```
-//! #![deny(unsafe_code)]
-//! #![deny(warnings)]
-//! #![no_std]
-//!
-//! extern crate cortex_m_rtfm as rtfm;
-//! extern crate stm32f103xx;
-//!
-//! use rtfm::{app, Resource, Threshold};
-//!
-//! app! {
-//! device: stm32f103xx,
-//!
-//! resources: {
-//! static COUNTER: u64 = 0;
-//! },
-//!
-//! tasks: {
-//! // The `SYS_TICK` task has higher priority than `TIM2`
-//! SYS_TICK: {
-//! path: sys_tick,
-//! priority: 2,
-//! resources: [COUNTER],
-//! },
-//!
-//! TIM2: {
-//! path: tim2,
-//! priority: 1,
-//! resources: [COUNTER],
-//! },
-//! },
-//! }
-//!
-//! fn init(_p: init::Peripherals, _r: init::Resources) {
-//! // ..
-//! }
-//!
-//! fn idle() -> ! {
-//! loop {
-//! rtfm::wfi();
-//! }
-//! }
-//!
-//! fn sys_tick(_t: &mut Threshold, mut r: SYS_TICK::Resources) {
-//! // ..
-//!
-//! // This task can't be preempted by `tim2` so it has direct access to the
-//! // resource data
-//! *r.COUNTER += 1;
-//!
-//! // ..
-//! }
-//!
-//! fn tim2(t: &mut Threshold, mut r: TIM2::Resources) {
-//! // ..
-//!
-//! // As this task runs at lower priority it needs a critical section to
-//! // prevent `sys_tick` from preempting it while it modifies this resource
-//! // data. The critical section is required to prevent data races which can
-//! // lead to undefined behavior.
-//! r.COUNTER.claim_mut(t, |counter, _t| {
-//! // `claim_mut` creates a critical section
-//! *counter += 1;
-//! });
-//!
-//! // ..
-//! }
-//! ```
-// Auto-generated. Do not modify.