1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-07 03:22:57 +03:00

clang format apply

This commit is contained in:
Leonid Fedorov
2022-02-11 12:24:40 +00:00
parent 509f005be7
commit 7c808317dc
1367 changed files with 394342 additions and 413129 deletions

View File

@@ -32,67 +32,64 @@ using namespace std;
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)
{
mutex.lock(); //pthread_mutex_lock(&mutex);
fbQueue.push_back(&blk);
mutex.lock(); // 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)
notEmpty.notify_one(); //pthread_cond_signal(&notEmpty);
// @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)
notEmpty.notify_one(); // pthread_cond_signal(&notEmpty);
mutex.unlock(); //pthread_mutex_unlock(&mutex);
mutex.unlock(); // pthread_mutex_unlock(&mutex);
return 0;
return 0;
}
void fileBlockRequestQueue::stop()
{
notEmpty.notify_all(); //pthread_cond_broadcast(&notEmpty);
notEmpty.notify_all(); // pthread_cond_broadcast(&notEmpty);
}
fileRequest* fileBlockRequestQueue::pop(void)
{
mutex.lock(); //pthread_mutex_lock(&mutex);
mutex.lock(); // pthread_mutex_lock(&mutex);
while (queueSize == 0)
{
readersWaiting++;
notEmpty.wait(mutex); //pthread_cond_wait(&notEmpty, &mutex);
readersWaiting--;
}
while (queueSize == 0)
{
readersWaiting++;
notEmpty.wait(mutex); // pthread_cond_wait(&notEmpty, &mutex);
readersWaiting--;
}
fileRequest* blk = fbQueue.front();
fbQueue.pop_front();
--queueSize;
mutex.unlock(); //pthread_mutex_unlock(&mutex);
return blk;
fileRequest* blk = fbQueue.front();
fbQueue.pop_front();
--queueSize;
mutex.unlock(); // pthread_mutex_unlock(&mutex);
return blk;
}
}
} // namespace dbbc