pub fn new(collect_interval: Duration) -> Self {
        let collector = basedrop::Collector::new();
        let handle = collector.handle();
        let collector = Arc::new(Mutex::new(collector));

        let state = Arc::new(Mutex::new(GarbageCollectorState {
            running: true,
            collect_interval,
        }));

        let thread = {
            let collector = collector.clone();
            let state = state.clone();
            std::thread::Builder::new()
                .name(String::from("gc-thread"))
                .spawn(move || run_collector_loop(collector, state))
                .unwrap()
        };

        GarbageCollector {
            collector,
            thread: Some(thread),
            handle,
            state,
        }
    }
/// Create the collector and start the garbage collector thread
Create the collector and start the garbage collector thread
Create the collector and start the garbage collector thread
pub fn new(collect_interval: Duration) -> Self {
        let collector = basedrop::Collector::new();
        let handle = collector.handle();
        let collector = Arc::new(Mutex::new(collector));
        let state = Arc::new(Mutex::new(GarbageCollectorState {
            running: true,
            collect_interval,
        }));
        let thread = {
            let collector = collector.clone();
            let state = state.clone();
            std::thread::Builder::new()
                .name(String::from("gc-thread"))
                .spawn(move || run_collector_loop(collector, state))
                .unwrap()
        };
        GarbageCollector {
            collector,
            thread: Some(thread),
            handle,
            state,
        }
    }
pub fn new ( collect_interval : Duration ) -> Self { let collector = basedrop :: Collector :: new ( ) ; let handle = collector . handle ( ) ; let collector = Arc :: new ( Mutex :: new ( collector ) ) ; let state = Arc :: new ( Mutex :: new ( GarbageCollectorState { running : true , collect_interval , } ) ) ; let thread = { let collector = collector . clone ( ) ; let state = state . clone ( ) ; std :: thread :: Builder :: new ( ) . name ( String :: from ( " " ) ) . spawn ( move | | run_collector_loop ( collector , state ) ) . unwrap ( ) } ; GarbageCollector { collector , thread : Some ( thread ) , handle , state , } }
Create the collector and start the garbage collector thread
Create the collector and start the garbage collector thread
collect_interval
Duration
collect_interval
Duration