Small Fix to Mutex Init (#6846)

This commit is contained in:
Connor Fitzgerald 2025-01-03 03:52:48 -05:00 committed by GitHub
parent 15a77b525c
commit 111a6a8ed1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,6 @@
use std::{borrow::Cow, slice}; use std::{borrow::Cow, slice};
use parking_lot::{lock_api::RawMutex, Mutex}; use parking_lot::Mutex;
use windows::Win32::{Foundation, System::Diagnostics::Debug}; use windows::Win32::{Foundation, System::Diagnostics::Debug};
// This is a mutex as opposed to an atomic as we need to completely // This is a mutex as opposed to an atomic as we need to completely
@ -9,7 +9,7 @@ use windows::Win32::{Foundation, System::Diagnostics::Debug};
// //
// By routing all the registration through these functions we can guarantee // By routing all the registration through these functions we can guarantee
// there is either 1 or 0 exception handlers registered, not multiple. // there is either 1 or 0 exception handlers registered, not multiple.
static EXCEPTION_HANDLER_COUNT: Mutex<usize> = Mutex::const_new(parking_lot::RawMutex::INIT, 0); static EXCEPTION_HANDLER_COUNT: Mutex<usize> = Mutex::new(0);
pub fn register_exception_handler() { pub fn register_exception_handler() {
let mut count_guard = EXCEPTION_HANDLER_COUNT.lock(); let mut count_guard = EXCEPTION_HANDLER_COUNT.lock();