mirror of https://gitee.com/bigwinds/arangodb
ASAN runtime errors
This commit is contained in:
parent
bb3df8cc84
commit
c51e144678
|
@ -39,3 +39,20 @@ std::atomic<int> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue