Commit 387bc494 authored by Pavel Vainerman's avatar Pavel Vainerman

(DBServer_MySQL): добавил mutex для 'query buffer'

parent 5512dac2
......@@ -245,6 +245,7 @@ bool DBServer_MySQL::writeToBase( const string& query )
// cout << "DBServer_MySQL: " << query << endl;
if( !db || !connect_ok )
{
uniset_mutex_lock l(mqbuf,200);
qbuf.push(query);
if( qbuf.size() > qbufSize )
{
......@@ -285,6 +286,8 @@ bool DBServer_MySQL::writeToBase( const string& query )
//--------------------------------------------------------------------------------------------
void DBServer_MySQL::flushBuffer()
{
uniset_mutex_lock l(mqbuf,400);
// Сперва пробуем очистить всё что накопилось в очереди до этого...
while( !qbuf.empty() )
{
......
......@@ -199,6 +199,7 @@ class DBServer_MySQL:
bool lastRemove;
void flushBuffer();
UniSetTypes::uniset_mutex mqbuf;
private:
DBTableMap tblMap;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment