File tree Expand file tree Collapse file tree 4 files changed +54
-9
lines changed
Expand file tree Collapse file tree 4 files changed +54
-9
lines changed Original file line number Diff line number Diff line change @@ -155,9 +155,6 @@ fn main() {
155155### 4. point
156156
157157``` rust
158- use synchronized :: synchronized_point;
159- use synchronized :: synchronized;
160-
161158/*
162159 An example implementation of synchronized code with
163160 one non-anonymous synchronization point.
@@ -166,8 +163,22 @@ use synchronized::synchronized;
166163 single named sync point. Each synchronization code executes in the same
167164 way as ordinary anonymous code, but execution occurs simultaneously in a
168165 multi-threaded environment in only one of them.
166+
167+ !!! In this example, the assembly requires the `point` feature to be active.
169168*/
170169
170+ #[cfg( feature = " point" )]
171+ use synchronized :: synchronized_point;
172+ #[cfg( feature = " point" )]
173+ use synchronized :: synchronized;
174+
175+ #[cfg( not(feature = " point" ) )]
176+ macro_rules! synchronized_point {
177+ [ $ ($ unk : tt )* ] => {
178+ println! (" !!! This example requires support for the `point` feature. Run the example with `cargo run --example point --all-features`." );
179+ };
180+ }
181+
171182fn main () {
172183 // A sync point named `COMB_SYNC` to group anonymous code syncs by name.
173184 synchronized_point! {(COMB_SYNC ) {
Original file line number Diff line number Diff line change 11
2- use synchronized:: synchronized_point;
3- use synchronized:: synchronized;
4-
52/*
63 An example implementation of synchronized code with
74 one non-anonymous synchronization point.
@@ -10,8 +7,22 @@ use synchronized::synchronized;
107 single named sync point. Each synchronization code executes in the same
118 way as ordinary anonymous code, but execution occurs simultaneously in a
129 multi-threaded environment in only one of them.
10+
11+ !!! In this example, the assembly requires the `point` feature to be active.
1312*/
1413
14+ #[ cfg( feature = "point" ) ]
15+ use synchronized:: synchronized_point;
16+ #[ cfg( feature = "point" ) ]
17+ use synchronized:: synchronized;
18+
19+ #[ cfg( not( feature = "point" ) ) ]
20+ macro_rules! synchronized_point {
21+ [ $( $unk: tt) * ] => {
22+ println!( "!!! This example requires support for the `point` feature. Run the example with `cargo run --example point --all-features`." ) ;
23+ } ;
24+ }
25+
1526fn main ( ) {
1627 // A sync point named `COMB_SYNC` to group anonymous code syncs by name.
1728 synchronized_point ! { ( COMB_SYNC ) {
Original file line number Diff line number Diff line change 11
2+ #[ cfg( feature = "point" ) ]
23use synchronized:: synchronized_point;
4+ #[ cfg( feature = "point" ) ]
35use synchronized:: synchronized;
46
7+
58/*
69 An example of the implementation of synchronized code with one non-anonymous (named)
710 synchronization point with one mutable variable.
11+
12+ !!! In this example, the assembly requires the `point` feature to be active.
813*/
914
15+ #[ cfg( not( feature = "point" ) ) ]
16+ macro_rules! synchronized_point {
17+ [ $( $unk: tt) * ] => {
18+ println!( "!!! This example requires support for the `point` feature. Run the example with `cargo run --example point_let --all-features`." ) ;
19+ } ;
20+ }
21+
1022fn main ( ) {
1123 // A sync point named `COMB_SYNC` to group anonymous code syncs by name.
1224 //
Original file line number Diff line number Diff line change @@ -168,9 +168,6 @@ fn main() {
168168### 4. point
169169
170170```rust
171- use synchronized::synchronized_point;
172- use synchronized::synchronized;
173-
174171/*
175172 An example implementation of synchronized code with
176173 one non-anonymous synchronization point.
@@ -179,8 +176,22 @@ use synchronized::synchronized;
179176 single named sync point. Each synchronization code executes in the same
180177 way as ordinary anonymous code, but execution occurs simultaneously in a
181178 multi-threaded environment in only one of them.
179+
180+ !!! In this example, the assembly requires the `point` feature to be active.
182181*/
183182
183+ #[cfg( feature = "point" )]
184+ use synchronized::synchronized_point;
185+ #[cfg( feature = "point" )]
186+ use synchronized::synchronized;
187+
188+ #[cfg( not(feature = "point") )]
189+ macro_rules! synchronized_point {
190+ [ $($unk:tt)* ] => {
191+ println!("!!! This example requires support for the `point` feature. Run the example with `cargo run --example point --all-features`.");
192+ };
193+ }
194+
184195fn main() {
185196 // A sync point named `COMB_SYNC` to group anonymous code syncs by name.
186197 synchronized_point! {(COMB_SYNC) {
You can’t perform that action at this time.
0 commit comments