1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-01 16:37:45 +00:00
sapphire/src/common/Database/DbWorker.h

40 lines
772 B
C
Raw Normal View History

#ifndef SAPPHIRE_DBWORKER_H
#define SAPPHIRE_DBWORKER_H
#include <atomic>
#include <thread>
2017-12-18 14:45:15 +01:00
#include <common/Util/LockedWaitQueue.h>
#include <boost/shared_ptr.hpp>
namespace Core
{
namespace Db
{
class DbConnection;
class Operation;
class DbWorker
{
public:
DbWorker( LockedWaitQueue< boost::shared_ptr< Operation > >* newQueue, DbConnection* connection );
~DbWorker();
private:
LockedWaitQueue< boost::shared_ptr< Operation > >* m_queue;
DbConnection* m_pConn;
void workerThread();
std::thread m_workerThread;
std::atomic< bool > m_cancelationToken;
DbWorker( DbWorker const& right ) = delete;
DbWorker& operator=( DbWorker const& right ) = delete;
};
}
}
#endif //SAPPHIRE_DBWORKER_H