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 ) ...@@ -245,6 +245,7 @@ bool DBServer_MySQL::writeToBase( const string& query )
// cout << "DBServer_MySQL: " << query << endl; // cout << "DBServer_MySQL: " << query << endl;
if( !db || !connect_ok ) if( !db || !connect_ok )
{ {
uniset_mutex_lock l(mqbuf,200);
qbuf.push(query); qbuf.push(query);
if( qbuf.size() > qbufSize ) if( qbuf.size() > qbufSize )
{ {
...@@ -285,6 +286,8 @@ bool DBServer_MySQL::writeToBase( const string& query ) ...@@ -285,6 +286,8 @@ bool DBServer_MySQL::writeToBase( const string& query )
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
void DBServer_MySQL::flushBuffer() void DBServer_MySQL::flushBuffer()
{ {
uniset_mutex_lock l(mqbuf,400);
// Сперва пробуем очистить всё что накопилось в очереди до этого... // Сперва пробуем очистить всё что накопилось в очереди до этого...
while( !qbuf.empty() ) while( !qbuf.empty() )
{ {
......
...@@ -199,6 +199,7 @@ class DBServer_MySQL: ...@@ -199,6 +199,7 @@ class DBServer_MySQL:
bool lastRemove; bool lastRemove;
void flushBuffer(); void flushBuffer();
UniSetTypes::uniset_mutex mqbuf;
private: private:
DBTableMap tblMap; 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