You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-08 14:22:09 +03:00
Merge pull request #516 from mariadb-corporation/MCOL-1037
MCOL-1037 Fix race condition in FIFO buffer
This commit is contained in:
@@ -345,17 +345,27 @@ void FIFO<element_t>::signalPs()
|
||||
template<typename element_t>
|
||||
inline bool FIFO<element_t>::next(uint64_t id, element_t *out)
|
||||
{
|
||||
base::mutex.lock();
|
||||
fConsumptionStarted = true;
|
||||
if (cpos[id] >= fMaxElements)
|
||||
{
|
||||
base::mutex.unlock();
|
||||
if (!waitForSwap(id))
|
||||
return false;
|
||||
base::mutex.lock();
|
||||
}
|
||||
|
||||
*out = cBuffer[cpos[id]++];
|
||||
|
||||
#ifndef ONE_CS
|
||||
if (cpos[id] == fMaxElements)
|
||||
{
|
||||
base::mutex.unlock();
|
||||
signalPs();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
base::mutex.unlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user