2
0
mirror of https://github.com/boostorg/atomic.git synced 2026-02-03 08:42:08 +00:00

Code cleanup. Implemented optimized atomic operations for Windows.

[SVN r81969]
This commit is contained in:
Andrey Semashev
2012-12-15 13:24:01 +00:00
parent 39760bdd91
commit 55f3aaadaf
20 changed files with 2078 additions and 478 deletions

View File

@@ -10,7 +10,14 @@ namespace boost {
namespace atomics {
namespace detail {
lockpool::lock_type lockpool::pool_[41];
static lockpool::lock_type lock_pool_[41];
// NOTE: This function must NOT be inline. Otherwise MSVC 9 will sometimes generate broken code for modulus operation which result in crashes.
BOOST_ATOMIC_DECL lockpool::lock_type& lockpool::get_lock_for(const volatile void* addr)
{
std::size_t index = reinterpret_cast<std::size_t>(addr) % (sizeof(lock_pool_) / sizeof(*lock_pool_));
return lock_pool_[index];
}
}
}