| 393 | } |
| 394 | |
| 395 | fn wake_by_ref(self: &Arc<Self>) { |
| 396 | match self.sleep_state.swap(SLEEP_STATE_WOKEN, Ordering::Relaxed) { |
| 397 | // If this future was currently being polled, or if someone else |
| 398 | // already woke it up, then there's nothing to do. |
| 399 | SLEEP_STATE_POLLING | SLEEP_STATE_WOKEN => {} |
| 400 | |
| 401 | // If this future is sleeping, however, then this is a cross-task |
| 402 | // wakeup meaning that we need to write to its wakeup stream. |
| 403 | other => { |
| 404 | assert_eq!(other, SLEEP_STATE_SLEEPING); |
| 405 | self.inter_task_stream.wake(); |
| 406 | } |
| 407 | } |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | const EVENT_NONE: u32 = 0; |