diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2019-05-19 20:55:37 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2019-05-19 20:55:37 +0200 |
commit | c07325f932abef2032b2e56532f6cb615e2a1161 (patch) | |
tree | 754ca158e45ebc014e5cbeaf4c3e7581f9575d76 /include/my_pthread.h | |
parent | 7f8187bc432f79afe4c0549d68845a68e6c159ab (diff) | |
parent | 2ae83affef5a4d89f38272db31a400f968279a7a (diff) | |
download | mariadb-git-c07325f932abef2032b2e56532f6cb615e2a1161.tar.gz |
Merge branch '10.3' into 10.4
Diffstat (limited to 'include/my_pthread.h')
-rw-r--r-- | include/my_pthread.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h index 4d33d1abdd4..1b35d0fdd0d 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ /* Defines to make different thread packages compatible */ @@ -23,6 +23,8 @@ #define ETIME ETIMEDOUT /* For FreeBSD */ #endif +#include <my_atomic.h> + #ifdef __cplusplus #define EXTERNC extern "C" extern "C" { @@ -815,6 +817,26 @@ extern uint thd_lib_detected; #define statistic_sub(V,C,L) (V)-=(C) #endif /* SAFE_STATISTICS */ +static inline void thread_safe_increment32(int32 *value) +{ + (void) my_atomic_add32_explicit(value, 1, MY_MEMORY_ORDER_RELAXED); +} + +static inline void thread_safe_decrement32(int32 *value) +{ + (void) my_atomic_add32_explicit(value, -1, MY_MEMORY_ORDER_RELAXED); +} + +static inline void thread_safe_increment64(int64 *value) +{ + (void) my_atomic_add64_explicit(value, 1, MY_MEMORY_ORDER_RELAXED); +} + +static inline void thread_safe_decrement64(int64 *value) +{ + (void) my_atomic_add64_explicit(value, -1, MY_MEMORY_ORDER_RELAXED); +} + /* No locking needed, the counter is owned by the thread */ |