threading: remove obsolete critsect macros
What changed, and why it matters
This commit simply deletes two unused C++ macros (ENTER_CRITICAL_SECTION and LEAVE_CRITICAL_SECTION) from a header file. These macros were non-RAII manual locking helpers that had been replaced by safer scoped lock wrappers. There is no runtime behavior change, no bug fix, and no security vulnerability being patched.
No security action needed. Treat as routine code hygiene / refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff removes the ENTER_CRITICAL_SECTION and LEAVE_CRITICAL_SECTION macro definitions from src/sync.h. These macros performed manual mutex.lock()/unlock() paired with deadlock-detection bookkeeping. They were superseded by RAII-based UniqueLock macros (LOCK, TRY_LOCK, WAIT_LOCK). The removal is a code-cleanup/refactoring change; no call sites are modified and no functional or security behavior changes.
Changed components
src/sync.hInspect captured patch +0 / −20
diff --git a/src/sync.h b/src/sync.h
index ee189bee..f863e5f5 100644
--- a/src/sync.h
+++ b/src/sync.h
@@ -39,12 +39,6 @@ LOCK2(mutex1, mutex2);
TRY_LOCK(mutex, name);
std::unique_lock<std::recursive_mutex> name(mutex, std::try_to_lock_t);
-
-ENTER_CRITICAL_SECTION(mutex); // no RAII
- mutex.lock();
-
-LEAVE_CRITICAL_SECTION(mutex); // no RAII
- mutex.unlock();
*/
///////////////////////////////
@@ -270,20 +264,6 @@ inline MutexType* MaybeCheckNotHeld(MutexType* m) LOCKS_EXCLUDED(m) LOCK_RETURNE
#define TRY_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs), true)
#define WAIT_LOCK(cs, name) UniqueLock name(LOCK_ARGS(cs))
-#define ENTER_CRITICAL_SECTION(cs) \
- { \
- EnterCritical(#cs, __FILE__, __LINE__, &cs); \
- (cs).lock(); \
- }
-
-#define LEAVE_CRITICAL_SECTION(cs) \
- { \
- std::string lockname; \
- CheckLastCritical((void*)(&cs), lockname, #cs, __FILE__, __LINE__); \
- (cs).unlock(); \
- LeaveCritical(); \
- }
-
//! Run code while locking a mutex.
//!
//! Examples:
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.