@@ -135,9 +135,7 @@ impl<Q:Send> Sem<Q> {
135
135
do task:: unkillable {
136
136
do ( || {
137
137
self . acquire ( ) ;
138
- unsafe {
139
- do task:: rekillable { blk( ) }
140
- }
138
+ do task:: rekillable { blk( ) }
141
139
} ) . finally {
142
140
self . release ( ) ;
143
141
}
@@ -234,10 +232,8 @@ impl<'self> Condvar<'self> {
234
232
// signaller already sent -- I mean 'unconditionally' in contrast
235
233
// with acquire().)
236
234
do ( || {
237
- unsafe {
238
- do task:: rekillable {
239
- let _ = WaitEnd . take_unwrap ( ) . recv ( ) ;
240
- }
235
+ do task:: rekillable {
236
+ let _ = WaitEnd . take_unwrap ( ) . recv ( ) ;
241
237
}
242
238
} ) . finally {
243
239
// Reacquire the condvar. Note this is back in the unkillable
@@ -516,14 +512,12 @@ impl RWLock {
516
512
* 'write' from other tasks will run concurrently with this one.
517
513
*/
518
514
pub fn write < U > ( & self , blk : & fn ( ) -> U ) -> U {
519
- unsafe {
520
- do task:: unkillable {
521
- ( & self . order_lock ) . acquire ( ) ;
522
- do ( & self . access_lock ) . access {
523
- ( & self . order_lock ) . release ( ) ;
524
- do task:: rekillable {
525
- blk( )
526
- }
515
+ do task:: unkillable {
516
+ ( & self . order_lock ) . acquire ( ) ;
517
+ do ( & self . access_lock ) . access {
518
+ ( & self . order_lock ) . release ( ) ;
519
+ do task:: rekillable {
520
+ blk( )
527
521
}
528
522
}
529
523
}
@@ -562,16 +556,14 @@ impl RWLock {
562
556
// which can't happen until T2 finishes the downgrade-read entirely.
563
557
// The astute reader will also note that making waking writers use the
564
558
// order_lock is better for not starving readers.
565
- unsafe {
566
- do task:: unkillable {
567
- ( & self . order_lock ) . acquire ( ) ;
568
- do ( & self . access_lock ) . access_cond |cond| {
569
- ( & self . order_lock ) . release ( ) ;
570
- do task:: rekillable {
571
- let opt_lock = Just ( & self . order_lock ) ;
572
- blk ( & Condvar { sem : cond. sem , order : opt_lock,
573
- token : NonCopyable :: new ( ) } )
574
- }
559
+ do task:: unkillable {
560
+ ( & self . order_lock ) . acquire ( ) ;
561
+ do ( & self . access_lock ) . access_cond |cond| {
562
+ ( & self . order_lock ) . release ( ) ;
563
+ do task:: rekillable {
564
+ let opt_lock = Just ( & self . order_lock ) ;
565
+ blk ( & Condvar { sem : cond. sem , order : opt_lock,
566
+ token : NonCopyable :: new ( ) } )
575
567
}
576
568
}
577
569
}
@@ -606,10 +598,8 @@ impl RWLock {
606
598
( & self . access_lock ) . acquire ( ) ;
607
599
( & self . order_lock ) . release ( ) ;
608
600
do ( || {
609
- unsafe {
610
- do task:: rekillable {
611
- blk( RWLockWriteMode { lock : self , token : NonCopyable :: new ( ) } )
612
- }
601
+ do task:: rekillable {
602
+ blk( RWLockWriteMode { lock : self , token : NonCopyable :: new ( ) } )
613
603
}
614
604
} ) . finally {
615
605
let writer_or_last_reader;
0 commit comments