WL#7914: Remove custom rwlock windows implementation
Affects: Server-5.7
—
Status: Complete
This worklog consist of three parts:
1) Remove custom rwlock windows implementation.
Currently we have a custom rwlock implementation that we use if
TryAcquireSRWLockExclusive() is not supported. But since this function is
now supported on all our Windows platforms (Windows 7+, Server 2008 R2+),
it can be removed.
2) Enable SAFE_MUTEX mutex wrappers on Windows debug builds.
Currently we only use SAFE_MUTEX on non-Windows platforms. SAFE_MUTEX
includes extra runtime checks that are useful for debugging.
3) General refactoring of mutex, rwlock and condition variable code.
Improve consistency, eliminate dead code, replace macros with inline
functions, extract to separate header files.
Note that this will only affect the SQL layer and not InnoDB since InnoDB
uses its own implementation.
User Documentation
==================
http://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-5.html
NF-1: After this WL, Windows binaries will require Windows 7 / Windows Server
2008 R2 or newer.
I-1: Setting -DSAFE_MUTEX=0|1 when running CMake will now work on Windows.
It is default on for debug builds.
Refactoring plan:
- Remove macros, have self-contained static inline functions.
- Move mutex code to thr_mutex.h/.c
- Move condition variable code to thr_cond.h/.c
- Move rwlock code to thr_rwlock.h/.c
- Don't defined pthread_* functions on Windows, instead introduce matching
native_* functions that map to OS primitives (pthread or Windows).
- Move non-pthread related code from my_pthread.h to my_global.h
Copyright (c) 2000, 2025, Oracle Corporation and/or its affiliates. All rights reserved.