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
103e0fb9
Commit
103e0fb9
authored
Apr 25, 2009
by
Vadim Tkachenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync to extension rev 55
parent
fee8858e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
36 deletions
+27
-36
include/sync0rw.ic
include/sync0rw.ic
+24
-33
sync/sync0arr.c
sync/sync0arr.c
+1
-1
sync/sync0rw.c
sync/sync0rw.c
+1
-1
trx/trx0sys.c
trx/trx0sys.c
+1
-1
No files found.
include/sync0rw.ic
View file @
103e0fb9
...
...
@@ -105,8 +105,7 @@ rw_lock_set_s_waiter_flag(
rw_lock_t* lock) /* in: rw-lock */
{
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
// os_compare_and_swap(&lock->s_waiters, 0, 1);
__sync_lock_test_and_set(&lock->s_waiters, 1);
os_compare_and_swap(&lock->s_waiters, 0, 1);
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
lock->s_waiters = 1;
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
...
...
@@ -118,8 +117,7 @@ rw_lock_set_x_waiter_flag(
rw_lock_t* lock) /* in: rw-lock */
{
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
// os_compare_and_swap(&lock->x_waiters, 0, 1);
__sync_lock_test_and_set(&lock->x_waiters, 1);
os_compare_and_swap(&lock->x_waiters, 0, 1);
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
lock->x_waiters = 1;
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
...
...
@@ -131,8 +129,7 @@ rw_lock_set_wx_waiter_flag(
rw_lock_t* lock) /* in: rw-lock */
{
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
// os_compare_and_swap(&lock->wait_ex_waiters, 0, 1);
__sync_lock_test_and_set(&lock->wait_ex_waiters, 1);
os_compare_and_swap(&lock->wait_ex_waiters, 0, 1);
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
lock->wait_ex_waiters = 1;
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
...
...
@@ -149,8 +146,7 @@ rw_lock_reset_s_waiter_flag(
rw_lock_t* lock) /* in: rw-lock */
{
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
// os_compare_and_swap(&lock->s_waiters, 1, 0);
__sync_lock_test_and_set(&lock->s_waiters, 0);
os_compare_and_swap(&lock->s_waiters, 1, 0);
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
lock->s_waiters = 0;
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
...
...
@@ -162,8 +158,7 @@ rw_lock_reset_x_waiter_flag(
rw_lock_t* lock) /* in: rw-lock */
{
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
// os_compare_and_swap(&lock->x_waiters, 1, 0);
__sync_lock_test_and_set(&lock->x_waiters, 0);
os_compare_and_swap(&lock->x_waiters, 1, 0);
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
lock->x_waiters = 0;
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
...
...
@@ -175,8 +170,7 @@ rw_lock_reset_wx_waiter_flag(
rw_lock_t* lock) /* in: rw-lock */
{
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
// os_compare_and_swap(&lock->wait_ex_waiters, 1, 0);
__sync_lock_test_and_set(&lock->wait_ex_waiters, 0);
os_compare_and_swap(&lock->wait_ex_waiters, 1, 0);
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
lock->wait_ex_waiters = 0;
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
...
...
@@ -569,16 +563,15 @@ rw_lock_x_lock_func_nowait(
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
success = FALSE;
if ((lock->reader_count == 0)
&& rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED) {
retry_x_lock:
/* try x-lock */
if(__sync_sub_and_fetch(&(lock->lock_word),
X_LOCK_DECR) == 0) {
if (lock->reader_count == 0) {
/* try to lock writer */
if(__sync_lock_test_and_set(&(lock->writer),RW_LOCK_EX)
== RW_LOCK_NOT_LOCKED) {
/* success */
/* try to lock writer */
if(__sync_lock_test_and_set(&(lock->writer),RW_LOCK_EX)
== RW_LOCK_NOT_LOCKED) {
retry_x_lock:
/* try x-lock */
if(__sync_sub_and_fetch(&(lock->lock_word),
X_LOCK_DECR) == 0) {
/* success */
lock->writer_thread = curr_thread;
lock->recursive = TRUE;
...
...
@@ -598,15 +591,13 @@ retry_x_lock:
return(TRUE);
} else {
/* x-unlock */
__sync_fetch_and_add(&(lock->lock_word),
X_LOCK_DECR);
/* fail (x-lock) */
if (__sync_fetch_and_add(&(lock->lock_word),X_LOCK_DECR)
== 0)
goto retry_x_lock;
}
} else {
/* fail (x-lock) */
if (__sync_fetch_and_add(&(lock->lock_word),X_LOCK_DECR)
== 0)
goto retry_x_lock;
__sync_lock_test_and_set(&(lock->writer),RW_LOCK_NOT_LOCKED);
}
}
...
...
@@ -686,11 +677,11 @@ rw_lock_s_unlock_func(
rw_lock_remove_debug_info(lock, pass, RW_LOCK_SHARED);
#endif
if (UNIV_UNLIKELY(last &&
__sync_lock_test_and_set(&lock->wait_ex_waiters
, 0))) {
if (UNIV_UNLIKELY(last &&
os_compare_and_swap(&lock->wait_ex_waiters, 1
, 0))) {
os_event_set(lock->wait_ex_event);
sync_array_object_signalled(sync_primary_wait_array);
}
else if (UNIV_UNLIKELY(last &&
__sync_lock_test_and_set(&lock->x_waiters
, 0))) {
else if (UNIV_UNLIKELY(last &&
os_compare_and_swap(&lock->x_waiters, 1
, 0))) {
os_event_set(lock->x_event);
sync_array_object_signalled(sync_primary_wait_array);
}
...
...
@@ -798,10 +789,10 @@ rw_lock_x_unlock_func(
rw_lock_remove_debug_info(lock, pass, RW_LOCK_EX);
#endif
if (last) {
if(
__sync_lock_test_and_set(&lock->s_waiters
, 0)){
if(
os_compare_and_swap(&lock->s_waiters, 1
, 0)){
s_sg = TRUE;
}
if(
__sync_lock_test_and_set(&lock->x_waiters
, 0)){
if(
os_compare_and_swap(&lock->x_waiters, 1
, 0)){
x_sg = TRUE;
}
}
...
...
sync/sync0arr.c
View file @
103e0fb9
...
...
@@ -483,7 +483,7 @@ sync_array_cell_print(
fprintf
(
file
,
"--Thread %lu has waited at %s line %lu"
" for %
.2f
seconds the semaphore:
\n
"
,
" for %
#.5g
seconds the semaphore:
\n
"
,
(
ulong
)
os_thread_pf
(
cell
->
thread
),
cell
->
file
,
(
ulong
)
cell
->
line
,
difftime
(
time
(
NULL
),
cell
->
reservation_time
));
...
...
sync/sync0rw.c
View file @
103e0fb9
...
...
@@ -474,7 +474,7 @@ rw_lock_s_lock_spin(
/* If wait_ex_waiter stalls, wakes it. */
if
(
lock
->
reader_count
==
0
&&
__sync_lock_test_and_set
(
&
lock
->
wait_ex_waiters
,
0
))
{
&&
os_compare_and_swap
(
&
lock
->
wait_ex_waiters
,
1
,
0
))
{
os_event_set
(
lock
->
wait_ex_event
);
sync_array_object_signalled
(
sync_primary_wait_array
);
}
...
...
trx/trx0sys.c
View file @
103e0fb9
...
...
@@ -673,7 +673,7 @@ trx_sys_update_mysql_binlog_offset(
trx_sysf_t
*
sys_header
;
const
char
*
file_name
;
if
(
ut_strlen
(
file_name
)
>=
TRX_SYS_MYSQL_MASTER_LOG_NAME_LEN
)
{
if
(
ut_strlen
(
file_name
_in
)
>=
TRX_SYS_MYSQL_MASTER_LOG_NAME_LEN
)
{
/* We cannot fit the name to the 512 bytes we have reserved */
/* -> To store relay log file information, file_name must fit to the 480 bytes */
...
...
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