()
| 2611 | } |
| 2612 | |
| 2613 | /// Executes the two closures, possibly in parallel. |
| 2614 | /// |
| 2615 | /// When executed on a thread that is currently registered as a worker (i.e. the |
| 2616 | /// closure inside [`Membership::activate`], [`ThreadPool::with_worker`], or |
| 2617 | /// similar) this is able to look up that registration and find the worker and |
| 2618 | /// thread-pool implicitly. |
| 2619 | /// |
| 2620 | /// If not called within a thread pool, this uses the [`DEFAULT_POOL`]. |
| 2621 | /// |
| 2622 | /// If you have a reference to a [`Worker`], it's better to use [`Worker::join`] |
| 2623 | /// instead. If you don't have a worker, but know which thread pool you want to |
| 2624 | /// use, [`ThreadPool::join`] is more appropriate. |
| 2625 | pub fn join<A, B, RA, RB>(a: A, b: B) -> (RA, RB) |
| 2626 | where |
| 2627 | A: FnOnce(&Worker) -> RA + Send, |
| 2628 | B: FnOnce(&Worker) -> RB + Send, |
| 2629 | RA: Send, |
| 2630 | RB: Send, |
| 2631 | { |
| 2632 | Worker::with_current(|worker| match worker { |
| 2633 | Some(worker) => worker.join(a, b), |
| 2634 | None => DEFAULT_POOL.join(a, b), |
| 2635 | }) |
| 2636 | } |
| 2637 | |
| 2638 | /// Creates a new scope for spawning non-static work. |
| 2639 | /// |
| 2640 | /// When executed on a thread that is currently registered as a worker (i.e. the |
| 2641 | /// closure inside [`Membership::activate`], [`ThreadPool::with_worker`], or |
nothing calls this directly
no test coverage detected