Commit 8c82ca17 authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-17441 - InnoDB transition to C++11 atomics

os_thread_count transition to Atomic_counter.
parent e60dc209
...@@ -73,7 +73,7 @@ typedef unsigned int mysql_pfs_key_t; ...@@ -73,7 +73,7 @@ typedef unsigned int mysql_pfs_key_t;
#endif /* HAVE_PSI_INTERFACE */ #endif /* HAVE_PSI_INTERFACE */
/** Number of threads active. */ /** Number of threads active. */
extern ulint os_thread_count; extern Atomic_counter<ulint> os_thread_count;
/***************************************************************//** /***************************************************************//**
Compares two thread ids for equality. Compares two thread ids for equality.
......
...@@ -28,7 +28,7 @@ Created 9/8/1995 Heikki Tuuri ...@@ -28,7 +28,7 @@ Created 9/8/1995 Heikki Tuuri
#include "srv0srv.h" #include "srv0srv.h"
/** Number of threads active. */ /** Number of threads active. */
ulint os_thread_count; Atomic_counter<ulint> os_thread_count;
/***************************************************************//** /***************************************************************//**
Compares two thread ids for equality. Compares two thread ids for equality.
...@@ -118,7 +118,7 @@ os_thread_create_func( ...@@ -118,7 +118,7 @@ os_thread_create_func(
CloseHandle(handle); CloseHandle(handle);
my_atomic_addlint(&os_thread_count, 1); os_thread_count++;
return((os_thread_t)new_thread_id); return((os_thread_t)new_thread_id);
#else /* _WIN32 else */ #else /* _WIN32 else */
...@@ -127,7 +127,7 @@ os_thread_create_func( ...@@ -127,7 +127,7 @@ os_thread_create_func(
pthread_attr_init(&attr); pthread_attr_init(&attr);
my_atomic_addlint(&os_thread_count, 1); os_thread_count++;
int ret = pthread_create(&new_thread_id, &attr, func, arg); int ret = pthread_create(&new_thread_id, &attr, func, arg);
...@@ -182,7 +182,7 @@ os_thread_exit(bool detach) ...@@ -182,7 +182,7 @@ os_thread_exit(bool detach)
pfs_delete_thread(); pfs_delete_thread();
#endif #endif
my_atomic_addlint(&os_thread_count, ulint(-1)); os_thread_count--;
#ifdef _WIN32 #ifdef _WIN32
ExitThread(0); ExitThread(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment