mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
MDEV-21256 after-merge fix: Use std::atomic
Starting with MariaDB Server 10.4, C++11 is being used. Hence, std::atomic should be preferred to my_atomic.
This commit is contained in:
parent
4b291588bb
commit
1b414c0313
2 changed files with 6 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2019, MariaDB Corporation.
|
||||
Copyright (c) 2019, 2020, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
@ -32,7 +32,7 @@ Created 1/20/1994 Heikki Tuuri
|
|||
|
||||
#ifndef UNIV_INNOCHECKSUM
|
||||
/** Seed value of ut_rnd_gen() */
|
||||
extern int32 ut_rnd_current;
|
||||
extern std::atomic<uint32_t> ut_rnd_current;
|
||||
|
||||
/** @return a pseudo-random 32-bit number */
|
||||
inline uint32_t ut_rnd_gen()
|
||||
|
@ -45,8 +45,7 @@ inline uint32_t ut_rnd_gen()
|
|||
x^19+x^18+x^14+x^13+x^11+x^10+x^9+x^8+x^6+1 */
|
||||
const uint32_t crc32c= 0x1edc6f41;
|
||||
|
||||
uint32_t rnd= my_atomic_load32_explicit(&ut_rnd_current,
|
||||
MY_MEMORY_ORDER_RELAXED);
|
||||
uint32_t rnd= ut_rnd_current.load(std::memory_order_relaxed);
|
||||
|
||||
if (UNIV_UNLIKELY(rnd == 0))
|
||||
{
|
||||
|
@ -61,7 +60,7 @@ inline uint32_t ut_rnd_gen()
|
|||
rnd^= crc32c;
|
||||
}
|
||||
|
||||
my_atomic_store32_explicit(&ut_rnd_current, rnd, MY_MEMORY_ORDER_RELAXED);
|
||||
ut_rnd_current.store(rnd, std::memory_order_relaxed);
|
||||
return rnd;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2019, MariaDB Corporation.
|
||||
Copyright (c) 2019, 2020, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
@ -27,7 +27,7 @@ Created 5/11/1994 Heikki Tuuri
|
|||
#include "ut0rnd.h"
|
||||
|
||||
/** Seed value of ut_rnd_gen() */
|
||||
int32 ut_rnd_current;
|
||||
std::atomic<uint32_t> ut_rnd_current;
|
||||
|
||||
/** These random numbers are used in ut_find_prime */
|
||||
/*@{*/
|
||||
|
|
Loading…
Reference in a new issue