mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[10865] Make DB code thread-safe. Original patch by Machiavelli and Kero99.
Signed-off-by: Ambal <pogrebniak@gala.net>
This commit is contained in:
parent
9b3535f803
commit
af66b470a8
8 changed files with 53 additions and 26 deletions
|
|
@ -55,9 +55,18 @@ class SqlTransaction : public SqlOperation
|
|||
{
|
||||
private:
|
||||
std::queue<const char *> m_queue;
|
||||
ACE_Thread_Mutex m_Mutex;
|
||||
public:
|
||||
SqlTransaction() {}
|
||||
void DelayExecute(const char *sql) { m_queue.push(mangos_strdup(sql)); }
|
||||
void DelayExecute(const char *sql)
|
||||
{
|
||||
char* _sql = mangos_strdup(sql);
|
||||
if (_sql)
|
||||
{
|
||||
ACE_Guard<ACE_Thread_Mutex> _lock(m_Mutex);
|
||||
m_queue.push(_sql);
|
||||
}
|
||||
}
|
||||
void Execute(Database *db);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue