1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +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

@ -29,62 +29,63 @@ threadpool::ThreadPool FEMsgHandler::threadPool;
namespace
{
class Runner
{
public:
Runner(FEMsgHandler* f) : target(f) { }
void operator()()
{
utils::setThreadName("FEMsgHandler");
target->threadFcn();
}
FEMsgHandler* target;
public:
Runner(FEMsgHandler* f) : target(f)
{
}
void operator()()
{
utils::setThreadName("FEMsgHandler");
target->threadFcn();
}
FEMsgHandler* target;
};
}
} // namespace
FEMsgHandler::FEMsgHandler() : die(false), running(false), sawData(false), sock(NULL)
{
}
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)
{
sock = i;
assert(sock);
sock = i;
assert(sock);
}
/* Note, the next two fcns strongly depend on ExeMgr's current implementation. There's a
@ -97,49 +98,48 @@ 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);
err = InetStreamSocket::pollConnection(connectionNum, 1000);
if (err == 1)
{
sawData = true;
return true;
}
if (err == 1)
{
sawData = true;
return true;
}
return false;
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 (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 (!die && (err == 2 || err == 1))
{
die = true;
jl->abort();
jl.reset();
}
running = false;
running = false;
}