1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-04 04:42:30 +03:00

Reformat all code to coding standard

This commit is contained in:
Andrew Hutchings
2017-10-26 17:18:17 +01:00
parent 4985f3456e
commit 01446d1e22
1296 changed files with 403852 additions and 353747 deletions

View File

@ -28,62 +28,69 @@
using namespace std;
namespace dbbc {
namespace dbbc
{
fileBlockRequestQueue::fileBlockRequestQueue() : queueSize(0), readersWaiting(0)
{
pthread_mutex_init(&mutex, NULL);
pthread_cond_init(&notEmpty, NULL);
pthread_mutex_init(&mutex, NULL);
pthread_cond_init(&notEmpty, NULL);
}
fileBlockRequestQueue::~fileBlockRequestQueue()
{
pthread_cond_destroy(&notEmpty);
pthread_mutex_destroy(&mutex);
pthread_cond_destroy(&notEmpty);
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);
int fileBlockRequestQueue::push(fileRequest& 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(&notEmpty);
pthread_mutex_unlock(&mutex);
return 0;
// @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(&notEmpty);
pthread_mutex_unlock(&mutex);
return 0;
}
void fileBlockRequestQueue::stop() {
pthread_cond_broadcast(&notEmpty);
void fileBlockRequestQueue::stop()
{
pthread_cond_broadcast(&notEmpty);
}
fileRequest* fileBlockRequestQueue::pop(void) {
pthread_mutex_lock(&mutex);
while (queueSize == 0) {
readersWaiting++;
pthread_cond_wait(&notEmpty, &mutex);
readersWaiting--;
}
fileRequest* fileBlockRequestQueue::pop(void)
{
pthread_mutex_lock(&mutex);
fileRequest* blk = fbQueue.front();
fbQueue.pop_front();
--queueSize;
pthread_mutex_unlock(&mutex);
return blk;
while (queueSize == 0)
{
readersWaiting++;
pthread_cond_wait(&notEmpty, &mutex);
readersWaiting--;
}
fileRequest* blk = fbQueue.front();
fbQueue.pop_front();
--queueSize;
pthread_mutex_unlock(&mutex);
return blk;
}
}