| 800 | /// |
| 801 | /// See also: [`Worker::block_on`] and [`block_on`]. |
| 802 | #[inline(always)] |
| 803 | pub fn block_on<F, T>(&'static self, future: F) -> T |
| 804 | where |
| 805 | F: Future<Output = T> + Send, |
| 806 | T: Send, |
| 807 | { |
| 808 | self.get_worker(|worker| match worker { |
| 809 | Some(worker) => worker.block_on(future), |
| 810 | None => futures_lite::future::block_on(future), |
| 811 | }) |
| 812 | } |
| 813 | |
| 814 | /// Executes the two closures, possibly in parallel. |
| 815 | /// |
| 816 | /// See also: [`Worker::join`] and [`join`]. |
| 817 | #[inline(always)] |
| 818 | pub fn join<A, B, RA, RB>(&'static self, a: A, b: B) -> (RA, RB) |
| 819 | where |
| 820 | A: FnOnce(&Worker) -> RA + Send, |
| 821 | B: FnOnce(&Worker) -> RB + Send, |
| 822 | RA: Send, |
| 823 | RB: Send, |
| 824 | { |
| 825 | self.with_worker(|worker| worker.join(a, b)) |
| 826 | } |
| 827 | |