File tree 1 file changed +9
-18
lines changed
1 file changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -145,24 +145,15 @@ mod lock {
145
145
}
146
146
}
147
147
148
+ // requires external synchronization
148
149
#[ cfg( all( windows, feature = "dbghelp" ) ) ]
149
- fn dbghelp_init ( ) -> Box < std:: any:: Any > {
150
- use winapi:: * ;
151
- struct Cleanup { handle : HANDLE }
152
-
153
- impl Drop for Cleanup {
154
- fn drop ( & mut self ) {
155
- unsafe { :: dbghelp:: SymCleanup ( self . handle ) ; }
156
- }
157
- }
158
-
159
- unsafe {
160
- let ret = :: dbghelp:: SymInitializeW ( kernel32:: GetCurrentProcess ( ) ,
161
- 0 as * mut _ , TRUE ) ;
162
- if ret != TRUE {
163
- Box :: new ( ( ) )
164
- } else {
165
- Box :: new ( Cleanup { handle : kernel32:: GetCurrentProcess ( ) } )
166
- }
150
+ unsafe fn dbghelp_init ( ) {
151
+ static mut INITIALIZED : bool = false ;
152
+
153
+ if !INITIALIZED {
154
+ dbghelp:: SymInitializeW ( kernel32:: GetCurrentProcess ( ) ,
155
+ 0 as * mut _ ,
156
+ winapi:: TRUE ) ;
157
+ INITIALIZED = true ;
167
158
}
168
159
}
You can’t perform that action at this time.
0 commit comments