File tree Expand file tree Collapse file tree 2 files changed +41
-2
lines changed
examples/lm3s6965/examples Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Original file line number Diff line number Diff line change 1+ #![ no_main]
2+ #![ no_std]
3+
4+ use panic_semihosting as _;
5+
6+ #[ rtic:: app( device = lm3s6965, dispatchers = [ SSI0 ] ) ]
7+ mod app {
8+ use cortex_m_semihosting:: { debug, hprintln} ;
9+ use super :: * ;
10+
11+ #[ shared]
12+ struct Shared { }
13+
14+ #[ local]
15+ struct Local { }
16+
17+ #[ init]
18+ fn init ( _cx : init:: Context ) -> ( Shared , Local ) {
19+ task1:: spawn ( ) . unwrap ( ) ;
20+ //task2::spawn(Default::default()).ok(); <--- This is rejected since not all args are Send and Sync
21+ ( Shared { } , Local { } )
22+ }
23+
24+ #[ task( priority = 1 ) ]
25+ async fn task1 ( cx : task1:: Context ) {
26+ hprintln ! ( "Hello from task1!" ) ;
27+ cx. local_spawner . task2 ( Default :: default ( ) ) . unwrap ( ) ;
28+ }
29+
30+ // Task where some args are !Send/!Sync
31+ #[ task( priority = 1 ) ]
32+ async fn task2 ( _cx : task2:: Context , _nsns : NotSendNotSync ) {
33+ hprintln ! ( "Hello from task2!" ) ;
34+ debug:: exit ( debug:: EXIT_SUCCESS ) ; // Exit QEMU simulator
35+ }
36+ }
37+
38+ #[ derive( Default , Debug ) ]
39+ struct NotSendNotSync ( core:: marker:: PhantomData < * mut u8 > ) ;
Original file line number Diff line number Diff line change @@ -28,8 +28,8 @@ mod app {
2828 fn init ( cx : init:: Context ) -> ( Shared , Local ) {
2929 Mono :: start ( cx. core . SYST , 12_000_000 ) ;
3030
31- incrementer:: spawn ( cx. local . wait_queue ) . ok ( ) . unwrap ( ) ;
32- waiter:: spawn ( cx. local . wait_queue ) . ok ( ) . unwrap ( ) ;
31+ incrementer:: spawn ( & * cx. local . wait_queue ) . ok ( ) . unwrap ( ) ;
32+ waiter:: spawn ( & * cx. local . wait_queue ) . ok ( ) . unwrap ( ) ;
3333
3434 let count = 0 ;
3535
You can’t perform that action at this time.
0 commit comments