File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 1
1
//! Module for logging on a separate thread
2
2
use std:: {
3
- sync:: {
4
- Arc , Mutex ,
5
- } ,
3
+ sync:: { Arc , Mutex } ,
6
4
thread:: { self , JoinHandle } ,
7
5
} ;
8
6
pub enum LoggerMessage {
@@ -56,12 +54,12 @@ impl Logger {
56
54
self . tx . send ( msg) . unwrap ( )
57
55
}
58
56
/// Waits for all threads to finish
59
- pub fn finish ( self ) {
57
+ pub fn finish ( self ) -> std :: thread :: Result < ( ) > {
60
58
// Logger thread should exit once it processes this signal
61
59
self . tx . send ( LoggerMessage :: Abort ) . unwrap ( ) ;
62
60
let mut lock = self . handle . lock ( ) . unwrap ( ) ;
63
61
let handle = lock. take ( ) . unwrap ( ) ;
64
- handle. join ( ) ;
62
+ handle. join ( )
65
63
}
66
64
}
67
65
@@ -72,7 +70,7 @@ mod tests {
72
70
fn it_works ( ) {
73
71
let logger = Logger :: new ( crossbeam_channel:: unbounded ( ) ) ;
74
72
logger. log ( "Hello World!!!" . into ( ) ) ;
75
- logger. finish ( ) ;
76
- assert ! ( false ) ;
73
+ _ = logger. finish ( ) ;
74
+ // assert!(false);
77
75
}
78
76
}
You can’t perform that action at this time.
0 commit comments