diff --git a/lib/Basics/DataProtector.cpp b/lib/Basics/DataProtector.cpp index a9daedaa7e..d57567d4f7 100644 --- a/lib/Basics/DataProtector.cpp +++ b/lib/Basics/DataProtector.cpp @@ -39,3 +39,20 @@ std::atomic arangodb::basics::DataProtector::_last(0); // TODO: Reactivate this template instantiation once everybody has gcc >= 4.9.2 // template class arangodb::basics::DataProtector<64>; + +int arangodb::basics::DataProtector::getMyId() { + int id = _mySlot; + if (id >= 0) { + return id; + } + while (true) { + int newId = _last + 1; + if (newId >= DATA_PROTECTOR_MULTIPLICITY) { + newId = 0; + } + if (_last.compare_exchange_strong(id, newId)) { + _mySlot = newId; + return newId; + } + } +} diff --git a/lib/Basics/DataProtector.h b/lib/Basics/DataProtector.h index 86c02dc7e0..bf240e0caa 100644 --- a/lib/Basics/DataProtector.h +++ b/lib/Basics/DataProtector.h @@ -146,22 +146,7 @@ class DataProtector { _list[id]._count--; // this is implicitly using memory_order_seq_cst } - int getMyId() { - int id = _mySlot; - if (id >= 0) { - return id; - } - while (true) { - int newId = _last + 1; - if (newId >= DATA_PROTECTOR_MULTIPLICITY) { - newId = 0; - } - if (_last.compare_exchange_strong(id, newId)) { - _mySlot = newId; - return newId; - } - } - } + int getMyId(); }; } // namespace arangodb::basics