File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -241,6 +241,20 @@ impl UpChannel {
241
241
242
242
Some ( UpChannel ( ptr) )
243
243
}
244
+
245
+ /// Wait until all data has been read by the debugger.
246
+ ///
247
+ /// *Note: This means that if no debugger is connected or if it isn't reading the rtt data,*
248
+ /// *this function will wait indefinitely.*
249
+ pub fn flush ( & self ) {
250
+ loop {
251
+ let ( write, read) = self . channel ( ) . read_pointers ( ) ;
252
+ if write == read {
253
+ break ;
254
+ }
255
+ core:: hint:: spin_loop ( ) ;
256
+ }
257
+ }
244
258
}
245
259
246
260
impl fmt:: Write for UpChannel {
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ impl RttChannel {
146
146
}
147
147
}
148
148
149
- fn read_pointers ( & self ) -> ( usize , usize ) {
149
+ pub ( crate ) fn read_pointers ( & self ) -> ( usize , usize ) {
150
150
let write = self . write . load ( SeqCst ) ;
151
151
let read = self . read . load ( SeqCst ) ;
152
152
You can’t perform that action at this time.
0 commit comments