Windows improvements : manual backport of

htttp://lists.mysql.com/commits/50957?f=plain
      
Always use TLS functions instead of __declspec(thread) to access 
thread local storage variables.
The change removes the necessity to recomplile the same source
files twice -  with USE_TLS for DLLs and without USE_TLS for EXEs.
Real benefit of this change is better readability and maintainability
of TLS functions within MySQL.
              
There is a performance loss using TlsXXX functions compared to __declspec 
but the difference is negligible in practice. In a sysbench-like benchmark 
I ran with with TlsGetValue, pthread_[get|set]_specific was called 600000000 
times and took 0.17sec of total 35min CPU time, or 0.008%.
This commit is contained in:
Vladislav Vaintroub 2009-09-30 03:22:57 +02:00
commit 2bc1930c6c
8 changed files with 15 additions and 87 deletions

View file

@ -13,7 +13,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# About "mysqlclient_notls", see note in "client/CMakeLists.txt"
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
ADD_DEFINITIONS("-DMYSQL_CLIENT")
@ -21,7 +20,7 @@ ADD_DEFINITIONS("-DMYSQL_CLIENT")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_EXECUTABLE(mysql_client_test mysql_client_test.c ../mysys/my_memmem.c)
TARGET_LINK_LIBRARIES(mysql_client_test mysqlclient_notls wsock32)
TARGET_LINK_LIBRARIES(mysql_client_test mysqlclient wsock32)
ADD_EXECUTABLE(bug25714 bug25714.c)
TARGET_LINK_LIBRARIES(bug25714 mysqlclient_notls wsock32)
TARGET_LINK_LIBRARIES(bug25714 mysqlclient wsock32)