summaryrefslogtreecommitdiff
path: root/storage/innobase/include/sync0rw.ic
diff options
context:
space:
mode:
authorMikael Ronstrom <mikael@mysql.com>2008-12-05 13:43:10 +0100
committerMikael Ronstrom <mikael@mysql.com>2008-12-05 13:43:10 +0100
commite9bdc258d913b45bdea7b1627d45a7100b718c56 (patch)
tree281c34859886e30a649be11d0760bb1f6da9de9a /storage/innobase/include/sync0rw.ic
parent7ceb6050eef4ad3980df2bfda9c0a553abdfbcc1 (diff)
downloadmariadb-git-e9bdc258d913b45bdea7b1627d45a7100b718c56.tar.gz
Added memory barriers to the portability layer in InnoDB
Removed dependency on pthread being an int
Diffstat (limited to 'storage/innobase/include/sync0rw.ic')
-rw-r--r--storage/innobase/include/sync0rw.ic19
1 files changed, 11 insertions, 8 deletions
diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic
index ce25ae0e6a8..e3f1d881cb4 100644
--- a/storage/innobase/include/sync0rw.ic
+++ b/storage/innobase/include/sync0rw.ic
@@ -254,6 +254,7 @@ rw_lock_s_lock_low(
return(TRUE); /* locking succeeded */
}
+/* TODO: The "direct" functions are not used. Remove them? */
/**********************************************************************
Low-level function which locks an rw-lock in s-mode when we know that it
is possible and none else is currently accessing the rw-lock structure.
@@ -279,6 +280,7 @@ rw_lock_s_lock_direct(
#endif
}
+/* TODO: The "direct" functions are not used. Remove them? */
/**********************************************************************
Low-level function which locks an rw-lock in x-mode when we know that it
is not locked and none else is currently accessing the rw-lock structure.
@@ -451,6 +453,7 @@ rw_lock_s_unlock_func(
#endif
}
+/* TODO: The "direct" functions are not used. Remove them? */
/**********************************************************************
Releases a shared mode lock when we know there are no waiters and none
else will access the lock during the time this function is executed. */
@@ -489,17 +492,16 @@ rw_lock_x_unlock_func(
#endif
)
{
- os_thread_id_t local_writer_thread;
+ uint local_pass;
ut_ad((lock->lock_word % X_LOCK_DECR) == 0);
/*
- Must reset writer_thread while we still have the lock.
+ Must reset pass while we still have the lock.
If we are not the last unlocker, we correct it later in the function,
which is harmless since we still hold the lock.
- TODO: are there any risks of a thread id == -1 on any platform?
*/
- local_writer_thread = lock->writer_thread;
- lock->writer_thread = -1;
+ local_pass = lock->pass;
+ lock->pass = 1;
#ifdef UNIV_SYNC_DEBUG
rw_lock_remove_debug_info(lock, pass, RW_LOCK_EX);
@@ -516,8 +518,8 @@ rw_lock_x_unlock_func(
}
} else {
- /* We still hold x-lock, so we correct writer_thread. */
- lock->writer_thread = local_writer_thread;
+ /* We still hold x-lock, so we correct pass. */
+ lock->pass = local_pass;
}
ut_ad(rw_lock_validate(lock));
@@ -527,6 +529,7 @@ rw_lock_x_unlock_func(
#endif
}
+/* TODO: The "direct" functions are not used. Remove them? */
/**********************************************************************
Releases an exclusive mode lock when we know there are no waiters, and
none else will access the lock durint the time this function is executed. */
@@ -544,7 +547,7 @@ rw_lock_x_unlock_direct(
#ifdef UNIV_SYNC_DEBUG
rw_lock_remove_debug_info(lock, 0, RW_LOCK_EX);
#endif
-
+ lock->pass = 1;
lock->lock_word += X_LOCK_DECR;
ut_ad(!rw_lock_get_waiters(lock));