@@ -22,7 +22,6 @@ use mem;
2222use os:: windows:: ffi:: OsStrExt ;
2323use path:: Path ;
2424use ptr;
25- use sys:: mutex:: Mutex ;
2625use sys:: c;
2726use sys:: fs:: { OpenOptions , File } ;
2827use sys:: handle:: Handle ;
@@ -31,6 +30,7 @@ use sys::stdio;
3130use sys:: cvt;
3231use sys_common:: { AsInner , FromInner , IntoInner } ;
3332use sys_common:: process:: { CommandEnv , EnvKey } ;
33+ use sys_common:: parking_lot:: raw_mutex:: RawMutex ;
3434use borrow:: Borrow ;
3535
3636////////////////////////////////////////////////////////////////////////////////
@@ -98,7 +98,7 @@ pub struct StdioPipes {
9898}
9999
100100struct DropGuard < ' a > {
101- lock : & ' a Mutex ,
101+ lock : & ' a RawMutex ,
102102}
103103
104104impl Command {
@@ -186,7 +186,7 @@ impl Command {
186186 //
187187 // For more information, msdn also has an article about this race:
188188 // http://support.microsoft.com/kb/315939
189- static CREATE_PROCESS_LOCK : Mutex = Mutex :: new ( ) ;
189+ static CREATE_PROCESS_LOCK : RawMutex = RawMutex :: INIT ;
190190 let _guard = DropGuard :: new ( & CREATE_PROCESS_LOCK ) ;
191191
192192 let mut pipes = StdioPipes {
@@ -238,19 +238,15 @@ impl fmt::Debug for Command {
238238}
239239
240240impl < ' 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 }
246244 }
247245}
248246
249247impl < ' a > Drop for DropGuard < ' a > {
250248 fn drop ( & mut self ) {
251- unsafe {
252- self . lock . unlock ( ) ;
253- }
249+ self . lock . unlock ( ) ;
254250 }
255251}
256252
0 commit comments