You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
fix(DEC): MCOL-5602 fixing potentially endless loop in DEC (#3049)
This commit is contained in:
@ -22,6 +22,7 @@
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include <sched.h>
|
||||
#include <atomic>
|
||||
|
||||
/*
|
||||
This is an attempt to wrap the differneces between Windows and Linux around atomic ops.
|
||||
@ -92,4 +93,15 @@ inline void atomicYield()
|
||||
sched_yield();
|
||||
}
|
||||
|
||||
// This f assumes decrement is smaller than minuend.
|
||||
template <typename T>
|
||||
inline void atomicSubstitute(typename std::atomic<T>& minuend, T decrement)
|
||||
{
|
||||
T expected = minuend.load();
|
||||
do
|
||||
{
|
||||
expected = minuend.load();
|
||||
} while (!minuend.compare_exchange_weak(expected, expected - decrement));
|
||||
}
|
||||
|
||||
} // namespace atomicops
|
||||
|
Reference in New Issue
Block a user