aboutsummaryrefslogtreecommitdiff
path: root/src/exception.rs
diff options
context:
space:
mode:
authorGravatar homunkulus <homunkulus@gmx.com> 2018-01-11 14:28:51 +0000
committerGravatar homunkulus <homunkulus@gmx.com> 2018-01-11 14:28:51 +0000
commit6a5a789b60f88c50bb8712fd35dfcb3339018cb0 (patch)
tree166503af50042e80b3f044caac4be587689dc5da /src/exception.rs
parentbdc7ca96c5593e410c8f49025d2b0fced7607a4d (diff)
parentee21e7d66a2975aa358f9a69185defa9fa5e4e85 (diff)
downloadcortex-m-6a5a789b60f88c50bb8712fd35dfcb3339018cb0.tar.gz
cortex-m-6a5a789b60f88c50bb8712fd35dfcb3339018cb0.tar.zst
cortex-m-6a5a789b60f88c50bb8712fd35dfcb3339018cb0.zip
Auto merge of #73 - japaric:itm, r=japaric
make `Stim::write_*` methods take `&mut self` instead of `&self` this prevents people from overlapping non-atomic write operations on the same stimulus port when working with generators (cooperative tasks). For example, with this change the following code won't compile ``` rust let stim = &mut ITM.stim[0]; let a = || { loop { // .. for byte in b"Hello, world!".iter() { while !stim.is_fifo_ready() { yield } stim.write_u8(*byte); } // .. } }; let b = || { loop { // .. for byte in b"The quick brown fox jumps over the lazy dog".iter() { while !stim.is_fifo_ready() { yield } stim.write_u8(*byte); } // .. } }; ``` A possible fix for the above code is to use different stimulus ports in each task (generator).
Diffstat (limited to 'src/exception.rs')
0 files changed, 0 insertions, 0 deletions