EverWrath/modules/acore/framework/Database/MySQLThreading.h
Yehonal ea286f7332 Rewritten Threading system using c++11 std instead of ACE
It also allow full compilation with clang under all supported platforms

Need tests
2016-08-19 10:58:37 +02:00

52 lines
1.5 KiB
C++

/*
* Copyright (C)
*
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef _MYSQLTHREADING_H
#define _MYSQLTHREADING_H
#include "Log.h"
class MySQL
{
public:
/*! Create a thread on the MySQL server to mirrior the calling thread,
initializes thread-specific variables and allows thread-specific
operations without concurrence from other threads.
This should only be called if multiple core threads are running
on the same MySQL connection. Seperate MySQL connections implicitly
create a mirror thread.
*/
static void Thread_Init()
{
mysql_thread_init();
sLog->outSQLDriver("Core thread with ID [" UI64FMTD "] initializing MySQL thread.",
ACORE::Thread::currentId());
}
/*! Shuts down MySQL thread and frees resources, should only be called
when we terminate. MySQL threads and connections are not configurable
during runtime.
*/
static void Thread_End()
{
mysql_thread_end();
sLog->outSQLDriver("Core thread with ID [" UI64FMTD "] shutting down MySQL thread.",
ACORE::Thread::currentId());
}
static void Library_Init()
{
mysql_library_init(-1, NULL, NULL);
}
static void Library_End()
{
mysql_library_end();
}
};
#endif