Skip to content

Commit eac3d62

Browse files
authored
Merge pull request #596 from alexcrichton/rename-unpark
Rename ThreadUnpark -> ThreadNotify
2 parents 207c005 + 5323e68 commit eac3d62

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/task_impl/std/mod.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ impl<F: Future> Spawn<F> {
238238
/// to complete. When a future cannot make progress it will use
239239
/// `thread::park` to block the current thread.
240240
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()));
242242

243243
loop {
244244
match self.poll_future_notify(&unpark, 0)? {
@@ -296,7 +296,7 @@ impl<S: Stream> Spawn<S> {
296296
/// Like `wait_future`, except only waits for the next element to arrive on
297297
/// the underlying stream.
298298
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()));
300300
loop {
301301
match self.poll_stream_notify(&unpark, 0) {
302302
Ok(Async::NotReady) => unpark.park(),
@@ -340,7 +340,7 @@ impl<S: Sink> Spawn<S> {
340340
/// be blocked until it's able to send the value.
341341
pub fn wait_send(&mut self, mut value: S::SinkItem)
342342
-> Result<(), S::SinkError> {
343-
let notify = Arc::new(ThreadUnpark::new(thread::current()));
343+
let notify = Arc::new(ThreadNotify::new(thread::current()));
344344
loop {
345345
value = match self.start_send_notify(value, &notify, 0)? {
346346
AsyncSink::NotReady(v) => v,
@@ -359,7 +359,7 @@ impl<S: Sink> Spawn<S> {
359359
/// The thread will be blocked until `poll_complete` returns that it's
360360
/// ready.
361361
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()));
363363
loop {
364364
if self.poll_flush_notify(&notify, 0)?.is_ready() {
365365
return Ok(())
@@ -374,7 +374,7 @@ impl<S: Sink> Spawn<S> {
374374
/// is not ready to be close yet, then the current thread will be blocked
375375
/// until it's closed.
376376
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()));
378378
loop {
379379
if self.close_notify(&notify, 0)?.is_ready() {
380380
return Ok(())
@@ -474,16 +474,16 @@ impl Unpark for RunInner {
474474
}
475475
}
476476

477-
// ===== ThreadUnpark =====
477+
// ===== ThreadNotify =====
478478

479-
struct ThreadUnpark {
479+
struct ThreadNotify {
480480
thread: thread::Thread,
481481
ready: AtomicBool,
482482
}
483483

484-
impl ThreadUnpark {
485-
fn new(thread: thread::Thread) -> ThreadUnpark {
486-
ThreadUnpark {
484+
impl ThreadNotify {
485+
fn new(thread: thread::Thread) -> ThreadNotify {
486+
ThreadNotify {
487487
thread: thread,
488488
ready: AtomicBool::new(false),
489489
}
@@ -496,7 +496,7 @@ impl ThreadUnpark {
496496
}
497497
}
498498

499-
impl Notify for ThreadUnpark {
499+
impl Notify for ThreadNotify {
500500
fn notify(&self, _unpark_id: usize) {
501501
self.ready.store(true, Ordering::SeqCst);
502502
self.thread.unpark()

0 commit comments

Comments
 (0)