@@ -238,7 +238,7 @@ impl<F: Future> Spawn<F> {
238
238
/// to complete. When a future cannot make progress it will use
239
239
/// `thread::park` to block the current thread.
240
240
pub fn wait_future ( & mut self ) -> Result < F :: Item , F :: Error > {
241
- let unpark = Arc :: new ( ThreadUnpark :: new ( thread:: current ( ) ) ) ;
241
+ let unpark = Arc :: new ( ThreadNotify :: new ( thread:: current ( ) ) ) ;
242
242
243
243
loop {
244
244
match self . poll_future_notify ( & unpark, 0 ) ? {
@@ -296,7 +296,7 @@ impl<S: Stream> Spawn<S> {
296
296
/// Like `wait_future`, except only waits for the next element to arrive on
297
297
/// the underlying stream.
298
298
pub fn wait_stream ( & mut self ) -> Option < Result < S :: Item , S :: Error > > {
299
- let unpark = Arc :: new ( ThreadUnpark :: new ( thread:: current ( ) ) ) ;
299
+ let unpark = Arc :: new ( ThreadNotify :: new ( thread:: current ( ) ) ) ;
300
300
loop {
301
301
match self . poll_stream_notify ( & unpark, 0 ) {
302
302
Ok ( Async :: NotReady ) => unpark. park ( ) ,
@@ -340,7 +340,7 @@ impl<S: Sink> Spawn<S> {
340
340
/// be blocked until it's able to send the value.
341
341
pub fn wait_send ( & mut self , mut value : S :: SinkItem )
342
342
-> Result < ( ) , S :: SinkError > {
343
- let notify = Arc :: new ( ThreadUnpark :: new ( thread:: current ( ) ) ) ;
343
+ let notify = Arc :: new ( ThreadNotify :: new ( thread:: current ( ) ) ) ;
344
344
loop {
345
345
value = match self . start_send_notify ( value, & notify, 0 ) ? {
346
346
AsyncSink :: NotReady ( v) => v,
@@ -359,7 +359,7 @@ impl<S: Sink> Spawn<S> {
359
359
/// The thread will be blocked until `poll_complete` returns that it's
360
360
/// ready.
361
361
pub fn wait_flush ( & mut self ) -> Result < ( ) , S :: SinkError > {
362
- let notify = Arc :: new ( ThreadUnpark :: new ( thread:: current ( ) ) ) ;
362
+ let notify = Arc :: new ( ThreadNotify :: new ( thread:: current ( ) ) ) ;
363
363
loop {
364
364
if self . poll_flush_notify ( & notify, 0 ) ?. is_ready ( ) {
365
365
return Ok ( ( ) )
@@ -374,7 +374,7 @@ impl<S: Sink> Spawn<S> {
374
374
/// is not ready to be close yet, then the current thread will be blocked
375
375
/// until it's closed.
376
376
pub fn wait_close ( & mut self ) -> Result < ( ) , S :: SinkError > {
377
- let notify = Arc :: new ( ThreadUnpark :: new ( thread:: current ( ) ) ) ;
377
+ let notify = Arc :: new ( ThreadNotify :: new ( thread:: current ( ) ) ) ;
378
378
loop {
379
379
if self . close_notify ( & notify, 0 ) ?. is_ready ( ) {
380
380
return Ok ( ( ) )
@@ -474,16 +474,16 @@ impl Unpark for RunInner {
474
474
}
475
475
}
476
476
477
- // ===== ThreadUnpark =====
477
+ // ===== ThreadNotify =====
478
478
479
- struct ThreadUnpark {
479
+ struct ThreadNotify {
480
480
thread : thread:: Thread ,
481
481
ready : AtomicBool ,
482
482
}
483
483
484
- impl ThreadUnpark {
485
- fn new ( thread : thread:: Thread ) -> ThreadUnpark {
486
- ThreadUnpark {
484
+ impl ThreadNotify {
485
+ fn new ( thread : thread:: Thread ) -> ThreadNotify {
486
+ ThreadNotify {
487
487
thread : thread,
488
488
ready : AtomicBool :: new ( false ) ,
489
489
}
@@ -496,7 +496,7 @@ impl ThreadUnpark {
496
496
}
497
497
}
498
498
499
- impl Notify for ThreadUnpark {
499
+ impl Notify for ThreadNotify {
500
500
fn notify ( & self , _unpark_id : usize ) {
501
501
self . ready . store ( true , Ordering :: SeqCst ) ;
502
502
self . thread . unpark ( )
0 commit comments