Skip to main content

fibonacci_waiter_example

Function fibonacci_waiter_example 

Source
async fn fibonacci_waiter_example(
    n: usize,
    waiter: Option<(WaitGroup, WaitGuard)>,
) -> usize
Expand description

Demonstrates use of the WaitGroup and WaitGuard to (very inefficiently) compute the Fibonacci number F(n) using recursive channels.

The given waiter will be used to detect when the work has finished and it will close the channels. Additionally, waiter can be omitted to show that without the WaitGroup, the tasks would not terminate.