summaryrefslogtreecommitdiff
path: root/storage/innobase/include/sync0sync.ic
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/include/sync0sync.ic')
-rw-r--r--storage/innobase/include/sync0sync.ic53
1 files changed, 26 insertions, 27 deletions
diff --git a/storage/innobase/include/sync0sync.ic b/storage/innobase/include/sync0sync.ic
index b3fde61db5e..f384e43779f 100644
--- a/storage/innobase/include/sync0sync.ic
+++ b/storage/innobase/include/sync0sync.ic
@@ -13,7 +13,7 @@ void
mutex_set_waiters(
/*==============*/
mutex_t* mutex, /* in: mutex */
- ulint n); /* in: value to set */
+ ulint n); /* in: value to set */
/**********************************************************************
Reserves a mutex for the current thread. If the mutex is reserved, the
function spins a preset time (controlled by SYNC_SPIN_ROUNDS) waiting
@@ -22,9 +22,10 @@ for the mutex before suspending the thread. */
void
mutex_spin_wait(
/*============*/
- mutex_t* mutex, /* in: pointer to mutex */
- const char* file_name,/* in: file name where mutex requested */
- ulint line); /* in: line where requested */
+ mutex_t* mutex, /* in: pointer to mutex */
+ const char* file_name, /* in: file name where mutex
+ requested */
+ ulint line); /* in: line where requested */
#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
Sets the debug information for a reserved mutex. */
@@ -64,10 +65,10 @@ mutex_test_and_set(
lw = &(mutex->lock_word);
- __asm MOV ECX, lw
- __asm MOV EDX, 1
- __asm XCHG EDX, DWORD PTR [ECX]
- __asm MOV res, EDX
+ __asm MOV ECX, lw
+ __asm MOV EDX, 1
+ __asm XCHG EDX, DWORD PTR [ECX]
+ __asm MOV res, EDX
/* The fence below would prevent this thread from reading the data
structure protected by the mutex before the test-and-set operation is
@@ -97,8 +98,8 @@ mutex_test_and_set(
code, and the second line tells the input to the asm code. */
asm volatile("movl $1, %%eax; xchgl (%%ecx), %%eax" :
- "=eax" (res), "=m" (*lw) :
- "ecx" (lw));
+ "=eax" (res), "=m" (*lw) :
+ "ecx" (lw));
return(res);
#else
ibool ret;
@@ -133,9 +134,9 @@ mutex_reset_lock_word(
lw = &(mutex->lock_word);
- __asm MOV EDX, 0
- __asm MOV ECX, lw
- __asm XCHG EDX, DWORD PTR [ECX]
+ __asm MOV EDX, 0
+ __asm MOV ECX, lw
+ __asm XCHG EDX, DWORD PTR [ECX]
#elif defined(not_defined) && defined(__GNUC__) && defined(UNIV_INTEL_X86)
ulint* lw;
@@ -146,11 +147,11 @@ mutex_reset_lock_word(
syntax. The 'l' after the mnemonics denotes a 32-bit operation. */
asm volatile("movl $0, %%eax; xchgl (%%ecx), %%eax" :
- "=m" (*lw) :
- "ecx" (lw) :
- "eax"); /* gcc does not seem to understand
- that our asm code resets eax: tell it
- explicitly that after the third ':' */
+ "=m" (*lw) :
+ "ecx" (lw) :
+ "eax"); /* gcc does not seem to understand that our asm code
+ resets eax: tell it explicitly that after the third
+ ':' */
#else
mutex->lock_word = 0;
@@ -181,7 +182,7 @@ UNIV_INLINE
ulint
mutex_get_waiters(
/*==============*/
- /* out: value to set */
+ /* out: value to set */
mutex_t* mutex) /* in: mutex */
{
volatile ulint* ptr; /* declared volatile to ensure that
@@ -208,7 +209,7 @@ mutex_exit(
mutex->thread_id = ULINT_UNDEFINED;
sync_thread_reset_level(mutex);
-#endif
+#endif
mutex_reset_lock_word(mutex);
/* A problem: we assume that mutex_reset_lock word
@@ -224,10 +225,10 @@ mutex_exit(
they are missed in mutex_signal_object. */
if (mutex_get_waiters(mutex) != 0) {
-
+
mutex_signal_object(mutex);
}
-
+
#ifdef UNIV_SYNC_PERF_STAT
mutex_exit_count++;
#endif
@@ -242,7 +243,7 @@ void
mutex_enter_func(
/*=============*/
mutex_t* mutex, /* in: pointer to mutex */
- const char* file_name, /* in: file name where locked */
+ const char* file_name, /* in: file name where locked */
ulint line) /* in: line where locked */
{
ut_ad(mutex_validate(mutex));
@@ -253,9 +254,8 @@ mutex_enter_func(
#ifndef UNIV_HOTBACKUP
mutex->count_using++;
#endif /* UNIV_HOTBACKUP */
-
- if (!mutex_test_and_set(mutex))
- {
+
+ if (!mutex_test_and_set(mutex)) {
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
#endif
@@ -263,5 +263,4 @@ mutex_enter_func(
}
mutex_spin_wait(mutex, file_name, line);
-
}