整理代码

This commit is contained in:
蒲爽 2026-09-28 21:33:04 +08:00
commit c7b4e178ec
364 changed files with 59691 additions and 0 deletions

54
util/Service.cpp Normal file
View file

@ -0,0 +1,54 @@
/*
*******************************************************************************
* INCLUDE
*******************************************************************************
*/
#include "Service.h"
#include <iostream>
/*
*******************************************************************************
* CLASS DEFINE
*******************************************************************************
*/
namespace Util
{
void Service::start()
{
if (isRunning())
return;
_pThread = new Poco::Thread();
try
{
_pThread->start(*this);
}
catch (Poco::Exception& e)
{
std::cout << " --> Service: Poco::Exception: " << e.displayText() << "(" << e.what() << ")" << std::endl;
}
catch (std::exception& e)
{
std::cout << " --> Service: std::exception: " << e.what() << std::endl;
}
}
void Service::stop()
{
if (isRunning())
{
cancel();
_pThread->join();
_pThread.reset();
reset();
}
}
bool Service::isRunning() const
{
return !_pThread.isNull() && _pThread->isRunning();
}
}