threading: remove unused template instantiations
What changed, and why it matters
This commit removes two unused C++ template instantiations from Bitcoin Core's synchronization code. Template instantiations are pre-compiled versions of a generic function for specific data types. The removed ones supported older mutex types that are no longer used by the ENTER_CRITICAL_SECTION macro. This is a routine cleanup with no security impact.
No action required. This is a benign code cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit deletes explicit template instantiations for EnterCritical with Mutex* and RecursiveMutex* pointer types in src/sync.cpp. These instantiations were only needed for the legacy ENTER_CRITICAL_SECTION macro. The remaining instantiations for std::mutex* and std::recursive_mutex* continue to support current code paths. There is no functional, behavioral, or security change.
Changed components
src/sync.cppInspect captured patch +0 / −2
diff --git a/src/sync.cpp b/src/sync.cpp
index e5be6fd1..fb60e3cf 100644
--- a/src/sync.cpp
+++ b/src/sync.cpp
@@ -206,8 +206,6 @@ void EnterCritical(const char* pszName, const char* pszFile, int nLine, MutexTyp
{
push_lock(cs, CLockLocation(pszName, pszFile, nLine, fTry, util::ThreadGetInternalName()));
}
-template void EnterCritical(const char*, const char*, int, Mutex*, bool);
-template void EnterCritical(const char*, const char*, int, RecursiveMutex*, bool);
template void EnterCritical(const char*, const char*, int, std::mutex*, bool);
template void EnterCritical(const char*, const char*, int, std::recursive_mutex*, bool);
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.