1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +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

@ -24,16 +24,20 @@ using namespace std;
using namespace joblist;
using namespace messageqcpp;
threadpool::ThreadPool FEMsgHandler::threadPool(50,100);
threadpool::ThreadPool FEMsgHandler::threadPool(50, 100);
namespace {
namespace
{
class Runner
{
public:
Runner(FEMsgHandler *f) : target(f) { }
void operator()() { target->threadFcn(); }
FEMsgHandler *target;
Runner(FEMsgHandler* f) : target(f) { }
void operator()()
{
target->threadFcn();
}
FEMsgHandler* target;
};
}
@ -42,42 +46,43 @@ FEMsgHandler::FEMsgHandler() : die(false), running(false), sawData(false), sock(
{
}
FEMsgHandler::FEMsgHandler(boost::shared_ptr<JobList> j, IOSocket *s) :
die(false), running(false), sawData(false), jl(j)
FEMsgHandler::FEMsgHandler(boost::shared_ptr<JobList> j, IOSocket* s) :
die(false), running(false), sawData(false), jl(j)
{
sock = s;
assert(sock);
sock = s;
assert(sock);
}
FEMsgHandler::~FEMsgHandler()
{
stop();
threadPool.join(thr);
stop();
threadPool.join(thr);
}
void FEMsgHandler::start()
{
if (!running) {
running = true;
thr = threadPool.invoke(Runner(this));
}
if (!running)
{
running = true;
thr = threadPool.invoke(Runner(this));
}
}
void FEMsgHandler::stop()
{
die = true;
jl.reset();
die = true;
jl.reset();
}
void FEMsgHandler::setJobList(boost::shared_ptr<JobList> j)
{
jl = j;
jl = j;
}
void FEMsgHandler::setSocket(IOSocket *i)
void FEMsgHandler::setSocket(IOSocket* i)
{
sock = i;
assert(sock);
sock = i;
assert(sock);
}
/* Note, the next two fcns strongly depend on ExeMgr's current implementation. There's a
@ -90,43 +95,49 @@ void FEMsgHandler::setSocket(IOSocket *i)
*/
bool FEMsgHandler::aborted()
{
if (sawData)
return true;
if (sawData)
return true;
boost::mutex::scoped_lock sl(mutex);
int err;
int connectionNum = sock->getConnectionNum();
boost::mutex::scoped_lock sl(mutex);
int err;
int connectionNum = sock->getConnectionNum();
err = InetStreamSocket::pollConnection(connectionNum, 1000);
if (err == 1) {
sawData = true;
return true;
}
return false;
err = InetStreamSocket::pollConnection(connectionNum, 1000);
if (err == 1)
{
sawData = true;
return true;
}
return false;
}
void FEMsgHandler::threadFcn()
{
int err = 0;
int connectionNum = sock->getConnectionNum();
int err = 0;
int connectionNum = sock->getConnectionNum();
/* This waits for the next readable event on sock. An abort is signaled
* by sending something (anything at the moment), then dropping the connection.
* This fcn exits on all other events.
*/
while (!die && err == 0) {
boost::mutex::scoped_lock sl(mutex);
err = InetStreamSocket::pollConnection(connectionNum, 1000);
}
/* This waits for the next readable event on sock. An abort is signaled
* by sending something (anything at the moment), then dropping the connection.
* This fcn exits on all other events.
*/
while (!die && err == 0)
{
boost::mutex::scoped_lock sl(mutex);
err = InetStreamSocket::pollConnection(connectionNum, 1000);
}
if (err == 1)
sawData = true; // there's data to read, must be the abort signal
if (!die && (err == 2 || err == 1)) {
die = true;
jl->abort();
jl.reset();
}
if (err == 1)
sawData = true; // there's data to read, must be the abort signal
running = false;
if (!die && (err == 2 || err == 1))
{
die = true;
jl->abort();
jl.reset();
}
running = false;
}