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
9232f0d8
Commit
9232f0d8
authored
Oct 30, 2008
by
Mikael Ronstrom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge port of Google SMP patch to Solaris
parent
eb1c9462
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
78 additions
and
51 deletions
+78
-51
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+2
-2
storage/innobase/include/os0sync.h
storage/innobase/include/os0sync.h
+7
-2
storage/innobase/include/os0sync.ic
storage/innobase/include/os0sync.ic
+20
-10
storage/innobase/include/srv0srv.h
storage/innobase/include/srv0srv.h
+1
-1
storage/innobase/include/sync0rw.h
storage/innobase/include/sync0rw.h
+2
-2
storage/innobase/include/sync0rw.ic
storage/innobase/include/sync0rw.ic
+8
-8
storage/innobase/include/sync0sync.h
storage/innobase/include/sync0sync.h
+5
-1
storage/innobase/include/sync0sync.ic
storage/innobase/include/sync0sync.ic
+5
-4
storage/innobase/include/univ.i
storage/innobase/include/univ.i
+7
-0
storage/innobase/srv/srv0srv.c
storage/innobase/srv/srv0srv.c
+3
-3
storage/innobase/srv/srv0start.c
storage/innobase/srv/srv0start.c
+2
-2
storage/innobase/sync/sync0arr.c
storage/innobase/sync/sync0arr.c
+2
-2
storage/innobase/sync/sync0rw.c
storage/innobase/sync/sync0rw.c
+12
-12
storage/innobase/sync/sync0sync.c
storage/innobase/sync/sync0sync.c
+2
-2
No files found.
storage/innobase/handler/ha_innodb.cc
View file @
9232f0d8
...
@@ -389,8 +389,8 @@ static SHOW_VAR innodb_status_variables[]= {
...
@@ -389,8 +389,8 @@ static SHOW_VAR innodb_status_variables[]= {
(
char
*
)
&
export_vars
.
innodb_dblwr_pages_written
,
SHOW_LONG
},
(
char
*
)
&
export_vars
.
innodb_dblwr_pages_written
,
SHOW_LONG
},
{
"dblwr_writes"
,
{
"dblwr_writes"
,
(
char
*
)
&
export_vars
.
innodb_dblwr_writes
,
SHOW_LONG
},
(
char
*
)
&
export_vars
.
innodb_dblwr_writes
,
SHOW_LONG
},
{
"have_
atomic_builtins
"
,
{
"have_
sync_atomic
"
,
(
char
*
)
&
export_vars
.
innodb_have_
atomic_builtins
,
SHOW_BOOL
},
(
char
*
)
&
export_vars
.
innodb_have_
sync_atomic
,
SHOW_BOOL
},
{
"heap_enabled"
,
{
"heap_enabled"
,
(
char
*
)
&
export_vars
.
innodb_heap_enabled
,
SHOW_BOOL
},
(
char
*
)
&
export_vars
.
innodb_heap_enabled
,
SHOW_BOOL
},
{
"log_waits"
,
{
"log_waits"
,
...
...
storage/innobase/include/os0sync.h
View file @
9232f0d8
...
@@ -12,6 +12,10 @@ Created 9/6/1995 Heikki Tuuri
...
@@ -12,6 +12,10 @@ Created 9/6/1995 Heikki Tuuri
#include "univ.i"
#include "univ.i"
#include "ut0lst.h"
#include "ut0lst.h"
#ifdef HAVE_SOLARIS_ATOMIC
#include <atomic.h>
#endif
#ifdef __WIN__
#ifdef __WIN__
#define os_fast_mutex_t CRITICAL_SECTION
#define os_fast_mutex_t CRITICAL_SECTION
...
@@ -261,7 +265,7 @@ os_fast_mutex_free(
...
@@ -261,7 +265,7 @@ os_fast_mutex_free(
/*===============*/
/*===============*/
os_fast_mutex_t
*
fast_mutex
);
/* in: mutex to free */
os_fast_mutex_t
*
fast_mutex
);
/* in: mutex to free */
#ifdef
HAVE_GCC_ATOMIC_BUILTINS
#ifdef
UNIV_SYNC_ATOMIC
/**************************************************************
/**************************************************************
Atomic compare-and-swap for InnoDB. Currently requires GCC atomic builtins. */
Atomic compare-and-swap for InnoDB. Currently requires GCC atomic builtins. */
UNIV_INLINE
UNIV_INLINE
...
@@ -272,6 +276,7 @@ os_compare_and_swap(
...
@@ -272,6 +276,7 @@ os_compare_and_swap(
volatile
lint
*
ptr
,
/* in: pointer to target */
volatile
lint
*
ptr
,
/* in: pointer to target */
lint
oldVal
,
/* in: value to compare to */
lint
oldVal
,
/* in: value to compare to */
lint
newVal
);
/* in: value to swap in */
lint
newVal
);
/* in: value to swap in */
/**************************************************************
/**************************************************************
Atomic increment for InnoDB. Currently requires GCC atomic builtins. */
Atomic increment for InnoDB. Currently requires GCC atomic builtins. */
UNIV_INLINE
UNIV_INLINE
...
@@ -282,7 +287,7 @@ os_atomic_increment(
...
@@ -282,7 +287,7 @@ os_atomic_increment(
volatile
lint
*
ptr
,
/* in: pointer to target */
volatile
lint
*
ptr
,
/* in: pointer to target */
lint
amount
);
/* in: amount of increment */
lint
amount
);
/* in: amount of increment */
#endif
/*
HAVE_GCC_ATOMIC_BUILTINS
*/
#endif
/*
UNIV_SYNC_ATOMIC
*/
#ifndef UNIV_NONINL
#ifndef UNIV_NONINL
#include "os0sync.ic"
#include "os0sync.ic"
...
...
storage/innobase/include/os0sync.ic
View file @
9232f0d8
...
@@ -45,9 +45,10 @@ os_fast_mutex_trylock(
...
@@ -45,9 +45,10 @@ os_fast_mutex_trylock(
#endif
#endif
}
}
#ifdef
HAVE_GCC_ATOMIC_BUILTINS
#ifdef
UNIV_SYNC_ATOMIC
/**************************************************************
/**************************************************************
Atomic compare-and-swap for InnoDB. Currently requires GCC atomic builtins. */
Atomic compare-and-swap for InnoDB. Currently requires GCC atomic builtins
or Solaris atomic_* functions. */
UNIV_INLINE
UNIV_INLINE
ibool
ibool
os_compare_and_swap(
os_compare_and_swap(
...
@@ -57,11 +58,15 @@ os_compare_and_swap(
...
@@ -57,11 +58,15 @@ os_compare_and_swap(
lint oldVal, /* in: value to compare to */
lint oldVal, /* in: value to compare to */
lint newVal) /* in: value to swap in */
lint newVal) /* in: value to swap in */
{
{
if(__sync_bool_compare_and_swap(ptr, oldVal, newVal)) {
#ifdef HAVE_GCC_ATOMIC_BULTINS
return(TRUE);
return (__sync_bool_compare_and_swap(ptr, oldVal, newVal));
}
#elif HAVE_SOLARIS_ATOMIC
lint retVal = (lint)atomic_cas_ulong((volatile ulong_t *)ptr,
return(FALSE);
oldVal, newVal);
return (retVal == oldVal);
#else
#error "Need support for atomic ops"
#endif
}
}
/**************************************************************
/**************************************************************
...
@@ -74,8 +79,13 @@ os_atomic_increment(
...
@@ -74,8 +79,13 @@ os_atomic_increment(
volatile lint* ptr, /* in: pointer to target */
volatile lint* ptr, /* in: pointer to target */
lint amount) /* in: amount of increment */
lint amount) /* in: amount of increment */
{
{
lint newVal = __sync_add_and_fetch(ptr, amount);
#ifdef HAVE_GCC_ATOMIC_BULTINS
return newVal;
return (__sync_add_and_fetch(ptr, amount));
#elif HAVE_SOLARIS_ATOMIC
return ((lint)atomic_add_long_nv((volatile ulong_t *)ptr, amount));
#else
#error "Need support for atomic ops"
#endif
}
}
#endif /*
HAVE_GCC_ATOMIC_BUILTINS
*/
#endif /*
UNIV_SYNC_ATOMIC
*/
storage/innobase/include/srv0srv.h
View file @
9232f0d8
...
@@ -523,7 +523,7 @@ struct export_var_struct{
...
@@ -523,7 +523,7 @@ struct export_var_struct{
ulint
innodb_buffer_pool_read_ahead_rnd
;
ulint
innodb_buffer_pool_read_ahead_rnd
;
ulint
innodb_dblwr_pages_written
;
ulint
innodb_dblwr_pages_written
;
ulint
innodb_dblwr_writes
;
ulint
innodb_dblwr_writes
;
ibool
innodb_have_
atomic_builtins
;
ibool
innodb_have_
sync_atomic
;
ibool
innodb_heap_enabled
;
ibool
innodb_heap_enabled
;
ulint
innodb_log_waits
;
ulint
innodb_log_waits
;
ulint
innodb_log_write_requests
;
ulint
innodb_log_write_requests
;
...
...
storage/innobase/include/sync0rw.h
View file @
9232f0d8
...
@@ -460,9 +460,9 @@ struct rw_lock_struct {
...
@@ -460,9 +460,9 @@ struct rw_lock_struct {
os_event_t
wait_ex_event
;
os_event_t
wait_ex_event
;
/* Event for next-writer to wait on. A thread
/* Event for next-writer to wait on. A thread
must decrement lock_word before waiting. */
must decrement lock_word before waiting. */
#ifndef
HAVE_GCC_ATOMIC_BUILTINS
#ifndef
UNIV_SYNC_ATOMIC
mutex_t
mutex
;
/* The mutex protecting rw_lock_struct */
mutex_t
mutex
;
/* The mutex protecting rw_lock_struct */
#endif
/*
HAVE_GCC_ATOMIC_BUILTINS
*/
#endif
/*
UNIV_SYNC_ATOMIC
*/
UT_LIST_NODE_T
(
rw_lock_t
)
list
;
UT_LIST_NODE_T
(
rw_lock_t
)
list
;
/* All allocated rw locks are put into a
/* All allocated rw locks are put into a
...
...
storage/innobase/include/sync0rw.ic
View file @
9232f0d8
...
@@ -103,7 +103,7 @@ rw_lock_get_reader_count(
...
@@ -103,7 +103,7 @@ rw_lock_get_reader_count(
return 0;
return 0;
}
}
#ifndef
HAVE_GCC_ATOMIC_BUILTINS
#ifndef
UNIV_SYNC_ATOMIC
UNIV_INLINE
UNIV_INLINE
mutex_t*
mutex_t*
rw_lock_get_mutex(
rw_lock_get_mutex(
...
@@ -146,7 +146,7 @@ rw_lock_lock_word_decr(
...
@@ -146,7 +146,7 @@ rw_lock_lock_word_decr(
ulint amount) /* in: amount of decrement */
ulint amount) /* in: amount of decrement */
{
{
#ifdef
HAVE_GCC_ATOMIC_BUILTINS
#ifdef
UNIV_SYNC_ATOMIC
lint local_lock_word = lock->lock_word;
lint local_lock_word = lock->lock_word;
while (local_lock_word > 0) {
while (local_lock_word > 0) {
...
@@ -159,7 +159,7 @@ rw_lock_lock_word_decr(
...
@@ -159,7 +159,7 @@ rw_lock_lock_word_decr(
}
}
return(FALSE);
return(FALSE);
#else /*
HAVE_GCC_ATOMIC_BUILTINS
*/
#else /*
UNIV_SYNC_ATOMIC
*/
ibool success = FALSE;
ibool success = FALSE;
mutex_enter(&(lock->mutex));
mutex_enter(&(lock->mutex));
...
@@ -170,7 +170,7 @@ rw_lock_lock_word_decr(
...
@@ -170,7 +170,7 @@ rw_lock_lock_word_decr(
mutex_exit(&(lock->mutex));
mutex_exit(&(lock->mutex));
return success;
return success;
#endif /*
HAVE_GCC_ATOMIC_BUILTINS
*/
#endif /*
UNIV_SYNC_ATOMIC
*/
}
}
...
@@ -186,11 +186,11 @@ rw_lock_lock_word_incr(
...
@@ -186,11 +186,11 @@ rw_lock_lock_word_incr(
ulint amount) /* in: amount of increment */
ulint amount) /* in: amount of increment */
{
{
#ifdef
HAVE_GCC_ATOMIC_BUILTINS
#ifdef
UNIV_SYNC_ATOMIC
return(os_atomic_increment(&(lock->lock_word), amount));
return(os_atomic_increment(&(lock->lock_word), amount));
#else /*
HAVE_GCC_ATOMIC_BUILTINS
*/
#else /*
UNIV_SYNC_ATOMIC
*/
lint local_lock_word;
lint local_lock_word;
...
@@ -203,7 +203,7 @@ rw_lock_lock_word_incr(
...
@@ -203,7 +203,7 @@ rw_lock_lock_word_incr(
return local_lock_word;
return local_lock_word;
#endif /*
HAVE_GCC_ATOMIC_BUILTINS
*/
#endif /*
UNIV_SYNC_ATOMIC
*/
}
}
...
@@ -352,7 +352,7 @@ rw_lock_x_lock_func_nowait(
...
@@ -352,7 +352,7 @@ rw_lock_x_lock_func_nowait(
ibool success;
ibool success;
#ifdef
HAVE_GCC_ATOMIC_BUILTINS
#ifdef
UNIV_SYNC_ATOMIC
success = os_compare_and_swap(&(lock->lock_word), X_LOCK_DECR, 0);
success = os_compare_and_swap(&(lock->lock_word), X_LOCK_DECR, 0);
#else
#else
...
...
storage/innobase/include/sync0sync.h
View file @
9232f0d8
...
@@ -16,6 +16,7 @@ Created 9/5/1995 Heikki Tuuri
...
@@ -16,6 +16,7 @@ Created 9/5/1995 Heikki Tuuri
#include "os0thread.h"
#include "os0thread.h"
#include "os0sync.h"
#include "os0sync.h"
#include "sync0arr.h"
#include "sync0arr.h"
#include "my_atomic.h"
#ifndef UNIV_HOTBACKUP
#ifndef UNIV_HOTBACKUP
extern
my_bool
timed_mutexes
;
extern
my_bool
timed_mutexes
;
...
@@ -476,7 +477,10 @@ struct mutex_struct {
...
@@ -476,7 +477,10 @@ struct mutex_struct {
test-and-set instruction in Win32 and
test-and-set instruction in Win32 and
x86 32/64 with GCC 4.1.0 or later version */
x86 32/64 with GCC 4.1.0 or later version */
#if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER)
#if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER)
#elif defined(HAVE_GCC_ATOMIC_BUILTINS)
#elif defined(MY_ATOMIC_NOLOCK)
/* We have my_atomic_* routines that are
intrinsically atomic, so no need for the
mutex. */
#else
#else
os_fast_mutex_t
os_fast_mutex_t
os_fast_mutex
;
/* In other systems we use this OS mutex
os_fast_mutex
;
/* In other systems we use this OS mutex
...
...
storage/innobase/include/sync0sync.ic
View file @
9232f0d8
...
@@ -88,8 +88,9 @@ mutex_test_and_set(
...
@@ -88,8 +88,9 @@ mutex_test_and_set(
/* mutex_fence(); */
/* mutex_fence(); */
return(res);
return(res);
#elif defined(HAVE_GCC_ATOMIC_BUILTINS)
#elif defined(MY_ATOMIC_NOLOCK)
return __sync_lock_test_and_set(&(mutex->lock_word), 1);
return ((byte)my_atomic_swap8(
(int8 volatile *)&(mutex->lock_word), 1));
#else
#else
ibool ret;
ibool ret;
...
@@ -126,11 +127,11 @@ mutex_reset_lock_word(
...
@@ -126,11 +127,11 @@ mutex_reset_lock_word(
__asm MOV EDX, 0
__asm MOV EDX, 0
__asm MOV ECX, lw
__asm MOV ECX, lw
__asm XCHG DL, BYTE PTR [ECX]
__asm XCHG DL, BYTE PTR [ECX]
#elif defined(
HAVE_GCC_ATOMIC_BUILTINS
)
#elif defined(
MY_ATOMIC_NOLOCK
)
/* In theory __sync_lock_release should be used to release the lock.
/* In theory __sync_lock_release should be used to release the lock.
Unfortunately, it does not work properly alone. The workaround is
Unfortunately, it does not work properly alone. The workaround is
that more conservative __sync_lock_test_and_set is used instead. */
that more conservative __sync_lock_test_and_set is used instead. */
__sync_lock_test_and_set(
&(mutex->lock_word), 0);
(void)my_atomic_swap8((int8 volatile *)
&(mutex->lock_word), 0);
#else
#else
mutex->lock_word = 0;
mutex->lock_word = 0;
...
...
storage/innobase/include/univ.i
View file @
9232f0d8
...
@@ -123,6 +123,13 @@ by one. */
...
@@ -123,6 +123,13 @@ by one. */
/* Use malloc instead of innodb additional memory pool (great with tcmalloc) */
/* Use malloc instead of innodb additional memory pool (great with tcmalloc) */
#
define
UNIV_DISABLE_MEM_POOL
#
define
UNIV_DISABLE_MEM_POOL
#
if
defined
(
HAVE_GCC_ATOMIC_BUILTINS
)
||
defined
(
HAVE_SOLARIS_ATOMIC
)
/*
* We have a full set of atomic ops available - we will use them
*/
#
define
UNIV_SYNC_ATOMIC
#
endif
/*
/*
#define UNIV_SQL_DEBUG
#define UNIV_SQL_DEBUG
#define UNIV_LOG_DEBUG
#define UNIV_LOG_DEBUG
...
...
storage/innobase/srv/srv0srv.c
View file @
9232f0d8
...
@@ -1900,10 +1900,10 @@ srv_export_innodb_status(void)
...
@@ -1900,10 +1900,10 @@ srv_export_innodb_status(void)
export_vars
.
innodb_buffer_pool_pages_misc
=
buf_pool
->
max_size
export_vars
.
innodb_buffer_pool_pages_misc
=
buf_pool
->
max_size
-
UT_LIST_GET_LEN
(
buf_pool
->
LRU
)
-
UT_LIST_GET_LEN
(
buf_pool
->
LRU
)
-
UT_LIST_GET_LEN
(
buf_pool
->
free
);
-
UT_LIST_GET_LEN
(
buf_pool
->
free
);
#ifdef
HAVE_GCC_ATOMIC_BUILTINS
#ifdef
UNIV_SYNC_ATOMIC
export_vars
.
innodb_have_
atomic_builtins
=
1
;
export_vars
.
innodb_have_
sync_atomic
=
1
;
#else
#else
export_vars
.
innodb_have_
atomic_builtins
=
0
;
export_vars
.
innodb_have_
sync_atomic
=
0
;
#endif
#endif
#ifdef UNIV_DISABLE_MEM_POOL
#ifdef UNIV_DISABLE_MEM_POOL
export_vars
.
innodb_heap_enabled
=
0
;
export_vars
.
innodb_heap_enabled
=
0
;
...
...
storage/innobase/srv/srv0start.c
View file @
9232f0d8
...
@@ -1068,9 +1068,9 @@ innobase_start_or_create_for_mysql(void)
...
@@ -1068,9 +1068,9 @@ innobase_start_or_create_for_mysql(void)
"InnoDB: The InnoDB memory heap has been disabled.
\n
"
);
"InnoDB: The InnoDB memory heap has been disabled.
\n
"
);
#endif
#endif
#ifdef
HAVE_GCC_ATOMIC_BUILTINS
#ifdef
UNIV_SYNC_ATOMIC
fprintf
(
stderr
,
fprintf
(
stderr
,
"InnoDB: Mutex and rw_lock use
GCC atomic builtin
s.
\n
"
);
"InnoDB: Mutex and rw_lock use
atomic
s.
\n
"
);
#endif
#endif
/* Since InnoDB does not currently clean up all its internal data
/* Since InnoDB does not currently clean up all its internal data
...
...
storage/innobase/sync/sync0arr.c
View file @
9232f0d8
...
@@ -834,8 +834,8 @@ sync_array_object_signalled(
...
@@ -834,8 +834,8 @@ sync_array_object_signalled(
/*========================*/
/*========================*/
sync_array_t
*
arr
)
/* in: wait array */
sync_array_t
*
arr
)
/* in: wait array */
{
{
#ifdef
HAVE_GCC_ATOMIC_BUILTINS
#ifdef
UNIV_SYNC_ATOMIC
__sync_fetch_and_add
(
&
(
arr
->
sg_count
),
1
);
(
void
)
os_atomic_increment
((
volatile
lint
*
)
&
(
arr
->
sg_count
),
1
);
#else
#else
sync_array_enter
(
arr
);
sync_array_enter
(
arr
);
...
...
storage/innobase/sync/sync0rw.c
View file @
9232f0d8
...
@@ -195,7 +195,7 @@ rw_lock_create_func(
...
@@ -195,7 +195,7 @@ rw_lock_create_func(
/* If this is the very first time a synchronization object is
/* If this is the very first time a synchronization object is
created, then the following call initializes the sync system. */
created, then the following call initializes the sync system. */
#ifndef
HAVE_GCC_ATOMIC_BUILTINS
#ifndef
UNIV_SYNC_ATOMIC
mutex_create
(
rw_lock_get_mutex
(
lock
),
SYNC_NO_ORDER_CHECK
);
mutex_create
(
rw_lock_get_mutex
(
lock
),
SYNC_NO_ORDER_CHECK
);
lock
->
mutex
.
cfile_name
=
cfile_name
;
lock
->
mutex
.
cfile_name
=
cfile_name
;
...
@@ -206,7 +206,7 @@ rw_lock_create_func(
...
@@ -206,7 +206,7 @@ rw_lock_create_func(
lock
->
mutex
.
mutex_type
=
1
;
lock
->
mutex
.
mutex_type
=
1
;
#endif
/* UNIV_DEBUG && !UNIV_HOTBACKUP */
#endif
/* UNIV_DEBUG && !UNIV_HOTBACKUP */
#endif
/*
HAVE_GCC_ATOMIC_BUILTINS
*/
#endif
/*
UNIV_SYNC_ATOMIC
*/
lock
->
lock_word
=
X_LOCK_DECR
;
lock
->
lock_word
=
X_LOCK_DECR
;
rw_lock_set_waiters
(
lock
,
0
);
rw_lock_set_waiters
(
lock
,
0
);
...
@@ -260,9 +260,9 @@ rw_lock_free(
...
@@ -260,9 +260,9 @@ rw_lock_free(
lock
->
magic_n
=
0
;
lock
->
magic_n
=
0
;
#ifndef
HAVE_GCC_ATOMIC_BUILTINS
#ifndef
UNIV_SYNC_ATOMIC
mutex_free
(
rw_lock_get_mutex
(
lock
));
mutex_free
(
rw_lock_get_mutex
(
lock
));
#endif
/*
HAVE_GCC_ATOMIC_BUILTINS
*/
#endif
/*
UNIV_SYNC_ATOMIC
*/
mutex_enter
(
&
rw_lock_list_mutex
);
mutex_enter
(
&
rw_lock_list_mutex
);
os_event_free
(
lock
->
event
);
os_event_free
(
lock
->
event
);
...
@@ -413,13 +413,13 @@ rw_lock_x_lock_move_ownership(
...
@@ -413,13 +413,13 @@ rw_lock_x_lock_move_ownership(
{
{
ut_ad
(
rw_lock_is_locked
(
lock
,
RW_LOCK_EX
));
ut_ad
(
rw_lock_is_locked
(
lock
,
RW_LOCK_EX
));
#ifdef
HAVE_GCC_ATOMIC_BUILTINS
#ifdef
UNIV_SYNC_ATOMIC
os_thread_id_t
local_writer_thread
=
lock
->
writer_thread
;
os_thread_id_t
local_writer_thread
=
lock
->
writer_thread
;
os_thread_id_t
new_writer_thread
=
os_thread_get_curr_id
();
os_thread_id_t
new_writer_thread
=
os_thread_get_curr_id
();
while
(
TRUE
)
{
while
(
TRUE
)
{
if
((
int
)
local_writer_thread
!=
-
1
)
{
if
((
int
)
local_writer_thread
!=
-
1
)
{
if
(
os_compare_and_swap
(
if
(
os_compare_and_swap
(
&
(
lock
->
writer_thread
),
(
volatile
lint
*
)
&
(
lock
->
writer_thread
),
local_writer_thread
,
local_writer_thread
,
new_writer_thread
))
{
new_writer_thread
))
{
break
;
break
;
...
@@ -428,12 +428,12 @@ rw_lock_x_lock_move_ownership(
...
@@ -428,12 +428,12 @@ rw_lock_x_lock_move_ownership(
local_writer_thread
=
lock
->
writer_thread
;
local_writer_thread
=
lock
->
writer_thread
;
}
}
lock
->
pass
=
0
;
lock
->
pass
=
0
;
#else
/*
HAVE_GCC_ATOMIC_BUILTINS
*/
#else
/*
UNIV_SYNC_ATOMIC
*/
mutex_enter
(
&
(
lock
->
mutex
));
mutex_enter
(
&
(
lock
->
mutex
));
lock
->
writer_thread
=
os_thread_get_curr_id
();
lock
->
writer_thread
=
os_thread_get_curr_id
();
lock
->
pass
=
0
;
lock
->
pass
=
0
;
mutex_exit
(
&
(
lock
->
mutex
));
mutex_exit
(
&
(
lock
->
mutex
));
#endif
/*
HAVE_GCC_ATOMIC_BUILTINS
*/
#endif
/*
UNIV_SYNC_ATOMIC
*/
}
}
/**********************************************************************
/**********************************************************************
...
@@ -883,7 +883,7 @@ rw_lock_list_print_info(
...
@@ -883,7 +883,7 @@ rw_lock_list_print_info(
count
++
;
count
++
;
#ifndef
HAVE_GCC_ATOMIC_BUILTINS
#ifndef
UNIV_SYNC_ATOMIC
mutex_enter
(
&
(
lock
->
mutex
));
mutex_enter
(
&
(
lock
->
mutex
));
#endif
#endif
if
(
lock
->
lock_word
!=
X_LOCK_DECR
)
{
if
(
lock
->
lock_word
!=
X_LOCK_DECR
)
{
...
@@ -902,7 +902,7 @@ rw_lock_list_print_info(
...
@@ -902,7 +902,7 @@ rw_lock_list_print_info(
info
=
UT_LIST_GET_NEXT
(
list
,
info
);
info
=
UT_LIST_GET_NEXT
(
list
,
info
);
}
}
}
}
#ifndef
HAVE_GCC_ATOMIC_BUILTINS
#ifndef
UNIV_SYNC_ATOMIC
mutex_exit
(
&
(
lock
->
mutex
));
mutex_exit
(
&
(
lock
->
mutex
));
#endif
#endif
...
@@ -928,7 +928,7 @@ rw_lock_print(
...
@@ -928,7 +928,7 @@ rw_lock_print(
"RW-LATCH INFO
\n
"
"RW-LATCH INFO
\n
"
"RW-LATCH: %p "
,
(
void
*
)
lock
);
"RW-LATCH: %p "
,
(
void
*
)
lock
);
#ifndef
HAVE_GCC_ATOMIC_BUILTINS
#ifndef
UNIV_SYNC_ATOMIC
mutex_enter
(
&
(
lock
->
mutex
));
mutex_enter
(
&
(
lock
->
mutex
));
#endif
#endif
if
(
lock
->
lock_word
!=
X_LOCK_DECR
)
{
if
(
lock
->
lock_word
!=
X_LOCK_DECR
)
{
...
@@ -945,7 +945,7 @@ rw_lock_print(
...
@@ -945,7 +945,7 @@ rw_lock_print(
info
=
UT_LIST_GET_NEXT
(
list
,
info
);
info
=
UT_LIST_GET_NEXT
(
list
,
info
);
}
}
}
}
#ifndef
HAVE_GCC_ATOMIC_BUILTINS
#ifndef
UNIV_SYNC_ATOMIC
mutex_exit
(
&
(
lock
->
mutex
));
mutex_exit
(
&
(
lock
->
mutex
));
#endif
#endif
}
}
...
...
storage/innobase/sync/sync0sync.c
View file @
9232f0d8
...
@@ -238,7 +238,7 @@ mutex_create_func(
...
@@ -238,7 +238,7 @@ mutex_create_func(
{
{
#if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER)
#if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER)
mutex_reset_lock_word
(
mutex
);
mutex_reset_lock_word
(
mutex
);
#elif defined(
HAVE_GCC_ATOMIC_BUILTINS
)
#elif defined(
MY_ATOMIC_NOLOCK
)
mutex_reset_lock_word
(
mutex
);
mutex_reset_lock_word
(
mutex
);
#else
#else
os_fast_mutex_init
(
&
(
mutex
->
os_fast_mutex
));
os_fast_mutex_init
(
&
(
mutex
->
os_fast_mutex
));
...
@@ -331,7 +331,7 @@ mutex_free(
...
@@ -331,7 +331,7 @@ mutex_free(
os_event_free
(
mutex
->
event
);
os_event_free
(
mutex
->
event
);
#if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER)
#if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER)
#elif defined(
HAVE_GCC_ATOMIC_BUILTINS
)
#elif defined(
MY_ATOMIC_NOLOCK
)
#else
#else
os_fast_mutex_free
(
&
(
mutex
->
os_fast_mutex
));
os_fast_mutex_free
(
&
(
mutex
->
os_fast_mutex
));
#endif
#endif
...
...
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