macos: clear runloop Option in sync with count
This commit is contained in:
parent
f9807a1876
commit
cd8fcd90ca
1 changed files with 1 additions and 5 deletions
|
|
@ -51,11 +51,6 @@ pub(crate) fn add_event_source(source: CFRunLoopSource) -> EventRegistration {
|
|||
runloop.add_source(&source.0, unsafe { kCFRunLoopCommonModes });
|
||||
tx.send(SendCFRunLoop(runloop)).unwrap();
|
||||
CFRunLoop::run_current();
|
||||
|
||||
// Remove the global if we exited the run loop
|
||||
let mut el = EVENT_LOOP.lock().unwrap();
|
||||
let _ = el.runloop.take();
|
||||
el.count = 0;
|
||||
info!("event loop thread exited");
|
||||
});
|
||||
event_loop.runloop = Some(rx.recv().expect("failed to start run loop thread"));
|
||||
|
|
@ -78,6 +73,7 @@ impl Drop for EventRegistration {
|
|||
|
||||
if event_loop.count == 0 {
|
||||
runloop.stop();
|
||||
event_loop.runloop.take();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue