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
clang format apply
This commit is contained in:
@ -23,74 +23,70 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "fileblockrequestqueue.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace dbbc
|
||||
{
|
||||
|
||||
|
||||
fileBlockRequestQueue::fileBlockRequestQueue() : queueSize(0), readersWaiting(0)
|
||||
{
|
||||
pthread_mutex_init(&mutex, NULL);
|
||||
pthread_cond_init(¬Empty, NULL);
|
||||
pthread_mutex_init(&mutex, NULL);
|
||||
pthread_cond_init(¬Empty, NULL);
|
||||
}
|
||||
|
||||
fileBlockRequestQueue::~fileBlockRequestQueue()
|
||||
{
|
||||
pthread_cond_destroy(¬Empty);
|
||||
pthread_mutex_destroy(&mutex);
|
||||
pthread_cond_destroy(¬Empty);
|
||||
pthread_mutex_destroy(&mutex);
|
||||
}
|
||||
|
||||
bool fileBlockRequestQueue::empty() const
|
||||
{
|
||||
return (queueSize == 0);
|
||||
return (queueSize == 0);
|
||||
}
|
||||
|
||||
fileRequest* fileBlockRequestQueue::top() const
|
||||
{
|
||||
return fbQueue.front();
|
||||
return fbQueue.front();
|
||||
}
|
||||
|
||||
int fileBlockRequestQueue::push(fileRequest& blk)
|
||||
{
|
||||
pthread_mutex_lock(&mutex);
|
||||
fbQueue.push_back(&blk);
|
||||
pthread_mutex_lock(&mutex);
|
||||
fbQueue.push_back(&blk);
|
||||
|
||||
// @bug 1007. Changed "== 1" to ">= 1" below. The wake up call was only being fired when the queue size was 1 which
|
||||
// caused only one i/o thread to be working at a time.
|
||||
if (++queueSize >= 1 && readersWaiting > 0)
|
||||
pthread_cond_signal(¬Empty);
|
||||
// @bug 1007. Changed "== 1" to ">= 1" below. The wake up call was only being fired when the queue size
|
||||
// was 1 which caused only one i/o thread to be working at a time.
|
||||
if (++queueSize >= 1 && readersWaiting > 0)
|
||||
pthread_cond_signal(¬Empty);
|
||||
|
||||
pthread_mutex_unlock(&mutex);
|
||||
pthread_mutex_unlock(&mutex);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void fileBlockRequestQueue::stop()
|
||||
{
|
||||
pthread_cond_broadcast(¬Empty);
|
||||
pthread_cond_broadcast(¬Empty);
|
||||
}
|
||||
|
||||
|
||||
fileRequest* fileBlockRequestQueue::pop(void)
|
||||
{
|
||||
pthread_mutex_lock(&mutex);
|
||||
pthread_mutex_lock(&mutex);
|
||||
|
||||
while (queueSize == 0)
|
||||
{
|
||||
readersWaiting++;
|
||||
pthread_cond_wait(¬Empty, &mutex);
|
||||
readersWaiting--;
|
||||
}
|
||||
while (queueSize == 0)
|
||||
{
|
||||
readersWaiting++;
|
||||
pthread_cond_wait(¬Empty, &mutex);
|
||||
readersWaiting--;
|
||||
}
|
||||
|
||||
fileRequest* blk = fbQueue.front();
|
||||
fbQueue.pop_front();
|
||||
--queueSize;
|
||||
pthread_mutex_unlock(&mutex);
|
||||
return blk;
|
||||
fileRequest* blk = fbQueue.front();
|
||||
fbQueue.pop_front();
|
||||
--queueSize;
|
||||
pthread_mutex_unlock(&mutex);
|
||||
return blk;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace dbbc
|
||||
|
Reference in New Issue
Block a user