File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ use io;
17
17
use str;
18
18
use sync:: atomic:: { self , Ordering } ;
19
19
use path:: { self , Path } ;
20
- use sys :: mutex :: Mutex ;
20
+ use sys_common :: parking_lot :: raw_mutex :: RawMutex ;
21
21
use ptr;
22
22
23
23
pub use sys:: backtrace:: {
@@ -50,16 +50,14 @@ const MAX_NB_FRAMES: usize = 100;
50
50
51
51
/// Prints the current backtrace.
52
52
pub fn print ( w : & mut dyn Write , format : PrintFormat ) -> io:: Result < ( ) > {
53
- static LOCK : Mutex = Mutex :: new ( ) ;
53
+ static LOCK : RawMutex = RawMutex :: INIT ;
54
54
55
55
// Use a lock to prevent mixed output in multithreading context.
56
56
// Some platforms also requires it, like `SymFromAddr` on Windows.
57
- unsafe {
58
- LOCK . lock ( ) ;
59
- let res = _print ( w, format) ;
60
- LOCK . unlock ( ) ;
61
- res
62
- }
57
+ LOCK . lock ( ) ;
58
+ let res = _print ( w, format) ;
59
+ LOCK . unlock ( ) ;
60
+ res
63
61
}
64
62
65
63
fn _print ( w : & mut dyn Write , format : PrintFormat ) -> io:: Result < ( ) > {
You can’t perform that action at this time.
0 commit comments