summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2016-11-02 15:27:12 +0400
committerSergey Vojtovich <svoj@mariadb.org>2016-12-13 16:38:20 +0400
commit8f9999b5fc658431cac66cf07b51b3f469faa20a (patch)
tree54f1c20a96f5775432fd0838c0d9c9230908f2ea
parent1369e70b561a53dd77da3c0b87217cf2d6c8328d (diff)
downloadmariadb-git-8f9999b5fc658431cac66cf07b51b3f469faa20a.tar.gz
MDEV-11212 - Clean-up MariaDB atomic operations
Removed my_atomic_initialize(): it doesn't make sense anymore.
-rw-r--r--include/my_atomic.h4
-rw-r--r--mysys/CMakeLists.txt2
-rw-r--r--mysys/my_atomic.c67
-rw-r--r--plugin/feedback/utils.cc2
-rw-r--r--storage/maria/unittest/lockman-t.c4
-rw-r--r--storage/maria/unittest/lockman1-t.c4
-rw-r--r--storage/maria/unittest/lockman2-t.c4
-rw-r--r--storage/maria/unittest/trnman-t.c3
-rw-r--r--unittest/mysys/lf-t.c5
-rw-r--r--unittest/mysys/my_atomic-t.c6
-rw-r--r--unittest/mysys/waiting_threads-t.c5
11 files changed, 4 insertions, 102 deletions
diff --git a/include/my_atomic.h b/include/my_atomic.h
index 65d98f52863..8c468e295d3 100644
--- a/include/my_atomic.h
+++ b/include/my_atomic.h
@@ -350,10 +350,6 @@ make_atomic_store(ptr)
#define LF_BACKOFF (1)
#endif
-#define MY_ATOMIC_OK 0
-#define MY_ATOMIC_NOT_1CPU 1
-extern int my_atomic_initialize();
-
#ifdef __ATOMIC_SEQ_CST
#define MY_MEMORY_ORDER_RELAXED __ATOMIC_RELAXED
#define MY_MEMORY_ORDER_CONSUME __ATOMIC_CONSUME
diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
index 892928ca69b..df45c05162b 100644
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
@@ -39,7 +39,7 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c my_default.c
my_getpagesize.c
lf_alloc-pin.c lf_dynarray.c lf_hash.c
safemalloc.c my_new.cc
- my_atomic.c my_getncpus.c my_safehash.c my_chmod.c my_rnd.c
+ my_getncpus.c my_safehash.c my_chmod.c my_rnd.c
my_uuid.c wqueue.c waiting_threads.c ma_dyncol.c ../sql-common/my_time.c
my_rdtsc.c my_context.c psi_noop.c
file_logger.c)
diff --git a/mysys/my_atomic.c b/mysys/my_atomic.c
deleted file mode 100644
index 26348b518ae..00000000000
--- a/mysys/my_atomic.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
-
- 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 Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- 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 St, Fifth Floor, Boston, MA 02110-1301 USA */
-
-#include <my_global.h>
-#include <my_sys.h>
-
-#include <my_atomic.h>
-
-/*
- checks that the current build of atomic ops
- can run on this machine
-
- RETURN
- ATOMIC_xxx values, see my_atomic.h
-*/
-int my_atomic_initialize()
-{
- compile_time_assert(sizeof(intptr) == sizeof(void *));
- /* currently the only thing worth checking is SMP/UP issue */
-#ifdef MY_ATOMIC_MODE_DUMMY
- return my_getncpus() == 1 ? MY_ATOMIC_OK : MY_ATOMIC_NOT_1CPU;
-#else
- return MY_ATOMIC_OK;
-#endif
-}
-
-#ifdef SAFE_MUTEX
-#undef pthread_mutex_init
-#undef pthread_mutex_destroy
-#undef pthread_mutex_lock
-#undef pthread_mutex_unlock
-
-void plain_pthread_mutex_init(safe_mutex_t *m)
-{
- pthread_mutex_init(& m->mutex, NULL);
-}
-
-void plain_pthread_mutex_destroy(safe_mutex_t *m)
-{
- pthread_mutex_destroy(& m->mutex);
-}
-
-void plain_pthread_mutex_lock(safe_mutex_t *m)
-{
- pthread_mutex_lock(& m->mutex);
-}
-
-void plain_pthread_mutex_unlock(safe_mutex_t *m)
-{
- pthread_mutex_unlock(& m->mutex);
-}
-
-#endif
-
-
diff --git a/plugin/feedback/utils.cc b/plugin/feedback/utils.cc
index 327db69feda..151ecf13c0c 100644
--- a/plugin/feedback/utils.cc
+++ b/plugin/feedback/utils.cc
@@ -374,9 +374,7 @@ int fill_misc_data(THD *thd, TABLE_LIST *tables)
{
TABLE *table= tables->table;
-#ifdef MY_ATOMIC_OK
INSERT1("Cpu_count", (my_getncpus(), UNSIGNED));
-#endif
INSERT1("Mem_total", (my_getphysmem(), UNSIGNED));
INSERT1("Now", (thd->query_start(), UNSIGNED));
diff --git a/storage/maria/unittest/lockman-t.c b/storage/maria/unittest/lockman-t.c
index 9b54a3d8ff9..261291e087a 100644
--- a/storage/maria/unittest/lockman-t.c
+++ b/storage/maria/unittest/lockman-t.c
@@ -251,10 +251,6 @@ int main()
plan(35);
- if (my_atomic_initialize())
- return exit_status();
-
-
lockman_init(&lockman, &loid2lo, 50);
for (i= 0; i < Nlos; i++)
diff --git a/storage/maria/unittest/lockman1-t.c b/storage/maria/unittest/lockman1-t.c
index ca959c6e6e3..4e57a805ec0 100644
--- a/storage/maria/unittest/lockman1-t.c
+++ b/storage/maria/unittest/lockman1-t.c
@@ -263,10 +263,6 @@ int main()
plan(35);
- if (my_atomic_initialize())
- return exit_status();
-
-
lockman_init(&lockman, &loid2lo, 50);
tablockman_init(&tablockman, &loid2lo1, 50);
diff --git a/storage/maria/unittest/lockman2-t.c b/storage/maria/unittest/lockman2-t.c
index c1d40159500..1685163ea43 100644
--- a/storage/maria/unittest/lockman2-t.c
+++ b/storage/maria/unittest/lockman2-t.c
@@ -295,10 +295,6 @@ int main(int argc __attribute__((unused)), char **argv)
plan(40);
- if (my_atomic_initialize())
- return exit_status();
-
-
tablockman_init(&tablockman, &loid2lo1, 50);
for (i= 0; i < Nlos; i++)
diff --git a/storage/maria/unittest/trnman-t.c b/storage/maria/unittest/trnman-t.c
index 78740eac9c1..8d1573e779a 100644
--- a/storage/maria/unittest/trnman-t.c
+++ b/storage/maria/unittest/trnman-t.c
@@ -141,9 +141,6 @@ int main(int argc __attribute__((unused)), char **argv)
plan(7);
- if (my_atomic_initialize())
- return exit_status();
-
pthread_mutex_init(&rt_mutex, 0);
pthread_attr_init(&attr);
#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE
diff --git a/unittest/mysys/lf-t.c b/unittest/mysys/lf-t.c
index cb0c2853d13..abfa74877f8 100644
--- a/unittest/mysys/lf-t.c
+++ b/unittest/mysys/lf-t.c
@@ -182,15 +182,12 @@ pthread_handler_t test_lf_hash(void *arg)
void do_tests()
{
- plan(7);
+ plan(6);
lf_alloc_init(&lf_allocator, sizeof(TLA), offsetof(TLA, not_used));
lf_hash_init(&lf_hash, sizeof(int), LF_HASH_UNIQUE, 0, sizeof(int), 0,
&my_charset_bin);
- bad= my_atomic_initialize();
- ok(!bad, "my_atomic_initialize() returned %d", bad);
-
with_my_thread_init= 1;
test_concurrently("lf_pinbox (with my_thread_init)", test_lf_pinbox, N= THREADS, CYCLES);
test_concurrently("lf_alloc (with my_thread_init)", test_lf_alloc, N= THREADS, CYCLES);
diff --git a/unittest/mysys/my_atomic-t.c b/unittest/mysys/my_atomic-t.c
index 0f21c33455e..79e93b36ad9 100644
--- a/unittest/mysys/my_atomic-t.c
+++ b/unittest/mysys/my_atomic-t.c
@@ -118,11 +118,7 @@ pthread_handler_t test_atomic_cas(void *arg)
void do_tests()
{
- plan(6);
-
- bad= my_atomic_initialize();
- ok(!bad, "my_atomic_initialize() returned %d", bad);
-
+ plan(5);
b32= c32= 0;
test_concurrently("my_atomic_add32", test_atomic_add, THREADS, CYCLES);
diff --git a/unittest/mysys/waiting_threads-t.c b/unittest/mysys/waiting_threads-t.c
index 35e86aca319..66b9258185e 100644
--- a/unittest/mysys/waiting_threads-t.c
+++ b/unittest/mysys/waiting_threads-t.c
@@ -186,14 +186,11 @@ void do_tests()
skip(1, "Big test skipped");
return;
}
- plan(14);
+ plan(13);
compile_time_assert(THREADS >= 4);
DBUG_PRINT("wt", ("================= initialization ==================="));
- bad= my_atomic_initialize();
- ok(!bad, "my_atomic_initialize() returned %d", bad);
-
pthread_cond_init(&thread_sync, 0);
pthread_mutex_init(&lock, 0);
wt_init();