new

Function new 

Source
pub fn new() -> (DropNotifier, DropAwaiter)
Expand description

Function that spawns pair DropNotifier and DropAwaiter Clone and pass Notifier further into your code. Once all Notifiers will be dropped, they will notify the Awaiter that it is time to wake up

Usage:

async fn foo() {
    let (notifier_1, awaiter) = drop_awaiter::new();
     
    let notifier_2 = notifier_1.clone();

    std::thread::spawn(move || {
        // Perform task 1
        // ...
        drop(notifier_1);    
    });
     
    std::thread::spawn(move || {
        // Perform task 2    
        // ...
        drop(notifier_2);    
    });
     

    awaiter.await
}