aboutsummaryrefslogtreecommitdiff
path: root/src/shared/Database/SqlOperations.h
diff options
context:
space:
mode:
authorMachiavelli <none@none>2010-05-15 14:58:16 +0200
committerMachiavelli <none@none>2010-05-15 14:58:16 +0200
commitfa57ce4cd12082e92f4da59c93b2f711f7e36ecd (patch)
tree153606182e293a997c40f45b94a59e83bcc53560 /src/shared/Database/SqlOperations.h
parent7ff9e82f1a237b80ea42f0f6055e408634db841a (diff)
Reimplement ACE_Based::LockedQueue as SQL holder for the SqlTransaction class, since std::queue is not safe when multiple threads are reading/writing to it at the same time (SqlDelayThread and a MapUpdate Thread).
Original patch by thenecromancer, was removed for ungrounded reasons. Thanks to Zor for the insight. Please give feedback on how this affects mtmaps usage. --HG-- branch : trunk
Diffstat (limited to 'src/shared/Database/SqlOperations.h')
-rw-r--r--src/shared/Database/SqlOperations.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/shared/Database/SqlOperations.h b/src/shared/Database/SqlOperations.h
index 0a54af70ffb..dcdada9cb59 100644
--- a/src/shared/Database/SqlOperations.h
+++ b/src/shared/Database/SqlOperations.h
@@ -57,11 +57,12 @@ class SqlStatement : public SqlOperation
class SqlTransaction : public SqlOperation
{
+ typedef ACE_Based::LockedQueue<const char *, ACE_Thread_Mutex> LockedQueue;
private:
- std::queue<const char *> m_queue;
+ LockedQueue m_queue;
public:
SqlTransaction() {}
- void DelayExecute(const char *sql) { m_queue.push(strdup(sql)); }
+ void DelayExecute(const char *sql) { m_queue.add(strdup(sql)); }
void Execute(Database *db);
};