reinterpreted byte to SpinMutex before locking. This removes the need to have an additional function accepting a pointer in the SpinMutex class
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/ae789f98 Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/ae789f98 Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/ae789f98 Branch: refs/heads/quickstep-28-29 Commit: ae789f981760de8d59b1d63e99e507a22210b6b1 Parents: 935d5d0 Author: rathijit <rathi...@node-2.aggregation.quickstep-pg0.wisc.cloudlab.us> Authored: Sun Aug 14 19:54:50 2016 -0500 Committer: Harshad Deshmukh <hbdeshm...@apache.org> Committed: Tue Sep 20 12:56:07 2016 -0500 ---------------------------------------------------------------------- storage/FastHashTable.hpp | 12 ++++++------ threading/SpinMutex.hpp | 2 -- 2 files changed, 6 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/ae789f98/storage/FastHashTable.hpp ---------------------------------------------------------------------- diff --git a/storage/FastHashTable.hpp b/storage/FastHashTable.hpp index 8d8d82b..c659a20 100644 --- a/storage/FastHashTable.hpp +++ b/storage/FastHashTable.hpp @@ -1900,7 +1900,7 @@ bool FastHashTable<resizable, serializable, force_key_copy, allow_duplicate_keys SpinSharedMutexSharedLock<true> resize_lock(resize_shared_mutex_); uint8_t *value = upsertCompositeKeyInternalFast(key, init_value_ptr, variable_size); if (value != nullptr) { - SpinMutex lock(value); + SpinMutexLock lock(*(reinterpret_cast<SpinMutex *>(value))); for (unsigned int k = 0; k < handles_.size(); ++k) { handles_[k]->mergeStatesFast(source_state + payload_offsets_[k], value + payload_offsets_[k]); } @@ -1914,7 +1914,7 @@ bool FastHashTable<resizable, serializable, force_key_copy, allow_duplicate_keys if (value == nullptr) { return false; } else { - SpinMutex lock(value); + SpinMutexLock lock(*(reinterpret_cast<SpinMutex *>(value))); for (unsigned int k = 0; k < handles_.size(); ++k) { handles_[k]->mergeStatesFast(source_state + payload_offsets_[k], value + payload_offsets_[k]); } @@ -2017,7 +2017,7 @@ bool FastHashTable<resizable, serializable, force_key_copy, allow_duplicate_keys continuing = true; break; } else { - SpinMutex lock(value); + SpinMutexLock lock(*(reinterpret_cast<SpinMutex *>(value))); for (unsigned int k = 0; k < handles_.size(); ++k) { local.clear(); if (argument_ids[k].size()) { @@ -2044,7 +2044,7 @@ bool FastHashTable<resizable, serializable, force_key_copy, allow_duplicate_keys if (value == nullptr) { return false; } else { - SpinMutex lock(value); + SpinMutexLock lock(*(reinterpret_cast<SpinMutex *>(value))); for (unsigned int k = 0; k < handles_.size(); ++k) { local.clear(); if (argument_ids[k].size()) { @@ -2170,7 +2170,7 @@ bool FastHashTable<resizable, serializable, force_key_copy, allow_duplicate_keys continuing = true; break; } else { - SpinMutex lock(value); + SpinMutexLock lock(*(reinterpret_cast<SpinMutex *>(value))); for (unsigned int k = 0; k < handles_.size(); ++k) { local.clear(); if (argument_ids[k].size()) { @@ -2201,7 +2201,7 @@ bool FastHashTable<resizable, serializable, force_key_copy, allow_duplicate_keys if (value == nullptr) { return false; } else { - SpinMutex lock(value); + SpinMutexLock lock(*(reinterpret_cast<SpinMutex *>(value))); for (unsigned int k = 0; k < handles_.size(); ++k) { local.clear(); if (argument_ids[k].size()) { http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/ae789f98/threading/SpinMutex.hpp ---------------------------------------------------------------------- diff --git a/threading/SpinMutex.hpp b/threading/SpinMutex.hpp index 106ef13..5ed1405 100644 --- a/threading/SpinMutex.hpp +++ b/threading/SpinMutex.hpp @@ -44,8 +44,6 @@ class SpinMutex { SpinMutex() : locked_(false) { } - explicit SpinMutex(uint8_t *ptr): locked_(*ptr) {} - /** * @note This call does NOT yield when contended. SpinMutex is intended * mainly for cases where locks are held briefly and it is better to