File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -26,14 +26,26 @@ fn main() {
2626
2727 // Listen to the Timer events
2828 std:: thread:: spawn ( move || {
29- while let Ok ( time) = rx. recv ( ) {
30- println ! ( "Thread 1 Notification: {}" , time) ;
29+ while let result = rx. recv ( ) {
30+ match result {
31+ Ok ( time) => println ! ( "Thread 2 Notification: {}" , time) ,
32+ Err ( err) => {
33+ println ! ( "Error Thread 1" ) ;
34+ break ;
35+ }
36+ }
3137 }
3238 } ) ;
3339
3440 std:: thread:: spawn ( move || {
35- while let Ok ( time) = rx2. recv ( ) {
36- println ! ( "Thread 2 Notification: {}" , time) ;
41+ while let result = rx2. recv ( ) {
42+ match result {
43+ Ok ( time) => println ! ( "Thread 2 Notification: {}" , time) ,
44+ Err ( err) => {
45+ println ! ( "Error Thread 2" ) ;
46+ break ;
47+ }
48+ }
3749 }
3850 } )
3951 . join ( )
You can’t perform that action at this time.
0 commit comments