Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
7c1b5800
Commit
7c1b5800
authored
Oct 15, 2008
by
Mikael Ronstrom
Browse files
Options
Browse Files
Download
Plain Diff
merge my-atomic patch
parents
5c6d63b2
e82dac8d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
4 deletions
+57
-4
configure.in
configure.in
+26
-0
include/atomic/nolock.h
include/atomic/nolock.h
+19
-2
include/my_atomic.h
include/my_atomic.h
+12
-2
No files found.
configure.in
View file @
7c1b5800
...
@@ -1753,6 +1753,32 @@ if test "x$mysql_cv_gcc_atomic_builtins" = xyes; then
...
@@ -1753,6 +1753,32 @@ if test "x$mysql_cv_gcc_atomic_builtins" = xyes; then
[Define to 1 if compiler provides atomic builtins.])
[Define to 1 if compiler provides atomic builtins.])
fi
fi
AC_CACHE_CHECK([whether the OS provides atomic_* functions like Solaris],
[mysql_cv_solaris_atomic], [AC_TRY_RUN([
#include <atomic.h>
int
main()
{
int foo = -10; int bar = 10;
if (atomic_add_int_nv((uint_t *)&foo, bar) || foo)
return -1;
bar = atomic_swap_uint((uint_t *)&foo, (uint_t)bar);
if (bar || foo != 10)
return -1;
bar = atomic_cas_uint((uint_t *)&bar, (uint_t)foo, 15);
if (bar)
return -1;
return 0;
}
], [mysql_cv_solaris_atomic=yes],
[mysql_cv_solaris_atomic=no],
[mysql_cv_solaris_atomic=no])])
if test "x$mysql_cv_solaris_atomic" = xyes; then
AC_DEFINE(HAVE_SOLARIS_ATOMIC, 1,
[Define to 1 if OS provides atomic_* functions like Solaris.])
fi
# Force static compilation to avoid linking problems/get more speed
# Force static compilation to avoid linking problems/get more speed
AC_ARG_WITH(mysqld-ldflags,
AC_ARG_WITH(mysqld-ldflags,
[ --with-mysqld-ldflags Extra linking arguments for mysqld],
[ --with-mysqld-ldflags Extra linking arguments for mysqld],
...
...
include/atomic/nolock.h
View file @
7c1b5800
...
@@ -28,11 +28,28 @@
...
@@ -28,11 +28,28 @@
#elif defined(_MSC_VER)
#elif defined(_MSC_VER)
#include "x86-msvc.h"
#include "x86-msvc.h"
#endif
#endif
#endif
#ifdef make_atomic_cas_body
#elif defined(HAVE_SOLARIS_ATOMIC)
#include "solaris.h"
#endif
/* __i386__ || _M_IX86 || HAVE_GCC_ATOMIC_BUILTINS */
#if defined(make_atomic_cas_body) || defined(MY_ATOMICS_MADE)
/*
* We have atomics that require no locking
*/
#define MY_ATOMIC_NOLOCK
#ifdef __SUNPRO_C
/*
* Sun Studio 12 (and likely earlier) does not accept a typedef struct {}
*/
typedef
char
my_atomic_rwlock_t
;
#else
typedef
struct
{
}
my_atomic_rwlock_t
;
typedef
struct
{
}
my_atomic_rwlock_t
;
#endif
#define my_atomic_rwlock_destroy(name)
#define my_atomic_rwlock_destroy(name)
#define my_atomic_rwlock_init(name)
#define my_atomic_rwlock_init(name)
#define my_atomic_rwlock_rdlock(name)
#define my_atomic_rwlock_rdlock(name)
...
...
include/my_atomic.h
View file @
7c1b5800
...
@@ -18,13 +18,21 @@
...
@@ -18,13 +18,21 @@
#define intptr void *
#define intptr void *
#ifndef MY_ATOMIC_MODE_RWLOCKS
#ifndef MY_ATOMIC_MODE_RWLOCKS
/*
* Attempt to do atomic ops without locks
*/
#include "atomic/nolock.h"
#include "atomic/nolock.h"
#endif
#endif
#ifndef make_atomic_cas_body
#ifndef MY_ATOMIC_NOLOCK
/*
* Have to use rw-locks for atomic ops
*/
#include "atomic/rwlock.h"
#include "atomic/rwlock.h"
#endif
#endif
#ifndef MY_ATOMICS_MADE
#ifndef make_atomic_add_body
#ifndef make_atomic_add_body
#define make_atomic_add_body(S) \
#define make_atomic_add_body(S) \
int ## S tmp=*a; \
int ## S tmp=*a; \
...
@@ -91,7 +99,7 @@ extern int ## S my_atomic_load ## S(int ## S volatile *a);
...
@@ -91,7 +99,7 @@ extern int ## S my_atomic_load ## S(int ## S volatile *a);
#define make_atomic_store(S) \
#define make_atomic_store(S) \
extern void my_atomic_store ## S(int ## S volatile *a, int ## S v);
extern void my_atomic_store ## S(int ## S volatile *a, int ## S v);
#endif
#endif
/* HAVE_INLINE */
make_atomic_cas
(
8
)
make_atomic_cas
(
8
)
make_atomic_cas
(
16
)
make_atomic_cas
(
16
)
...
@@ -129,6 +137,8 @@ make_atomic_swap(ptr)
...
@@ -129,6 +137,8 @@ make_atomic_swap(ptr)
#undef make_atomic_swap_body
#undef make_atomic_swap_body
#undef intptr
#undef intptr
#endif
/* MY_ATOMICS_MADE */
#ifdef _atomic_h_cleanup_
#ifdef _atomic_h_cleanup_
#include _atomic_h_cleanup_
#include _atomic_h_cleanup_
#undef _atomic_h_cleanup_
#undef _atomic_h_cleanup_
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment