1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use crossbeam_utils::sync::WaitGroup;

/// In the case of multithreading, you need to call clone and drop at the end func
#[derive(Clone, Debug)]
pub struct FastLogWaitGroup {
    pub inner: WaitGroup,
}

impl FastLogWaitGroup {
    pub fn new() -> Self {
        Self {
            inner: WaitGroup::new(),
        }
    }
    /// wait call fast_log::exit();
    pub fn do_wait(self) {
        self.inner.wait();
    }
    /// wait call fast_log::exit();
    pub fn wait(self) {
        crate::fast_log::exit();
        self.inner.wait();
    }
    ///send exit msg
    pub fn exit(self) {
        crate::fast_log::exit();
    }
}