@@ -22,7 +22,6 @@ use mem;
22
22
use os:: windows:: ffi:: OsStrExt ;
23
23
use path:: Path ;
24
24
use ptr;
25
- use sys:: mutex:: Mutex ;
26
25
use sys:: c;
27
26
use sys:: fs:: { OpenOptions , File } ;
28
27
use sys:: handle:: Handle ;
@@ -31,6 +30,7 @@ use sys::stdio;
31
30
use sys:: cvt;
32
31
use sys_common:: { AsInner , FromInner , IntoInner } ;
33
32
use sys_common:: process:: { CommandEnv , EnvKey } ;
33
+ use sys_common:: parking_lot:: raw_mutex:: RawMutex ;
34
34
use borrow:: Borrow ;
35
35
36
36
////////////////////////////////////////////////////////////////////////////////
@@ -98,7 +98,7 @@ pub struct StdioPipes {
98
98
}
99
99
100
100
struct DropGuard < ' a > {
101
- lock : & ' a Mutex ,
101
+ lock : & ' a RawMutex ,
102
102
}
103
103
104
104
impl Command {
@@ -186,7 +186,7 @@ impl Command {
186
186
//
187
187
// For more information, msdn also has an article about this race:
188
188
// http://support.microsoft.com/kb/315939
189
- static CREATE_PROCESS_LOCK : Mutex = Mutex :: new ( ) ;
189
+ static CREATE_PROCESS_LOCK : RawMutex = RawMutex :: INIT ;
190
190
let _guard = DropGuard :: new ( & CREATE_PROCESS_LOCK ) ;
191
191
192
192
let mut pipes = StdioPipes {
@@ -238,19 +238,15 @@ impl fmt::Debug for Command {
238
238
}
239
239
240
240
impl < ' a > DropGuard < ' a > {
241
- fn new ( lock : & ' a Mutex ) -> DropGuard < ' a > {
242
- unsafe {
243
- lock. lock ( ) ;
244
- DropGuard { lock }
245
- }
241
+ fn new ( lock : & ' a RawMutex ) -> DropGuard < ' a > {
242
+ lock. lock ( ) ;
243
+ DropGuard { lock }
246
244
}
247
245
}
248
246
249
247
impl < ' a > Drop for DropGuard < ' a > {
250
248
fn drop ( & mut self ) {
251
- unsafe {
252
- self . lock . unlock ( ) ;
253
- }
249
+ self . lock . unlock ( ) ;
254
250
}
255
251
}
256
252
0 commit comments