summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2008-09-06 11:53:08 +0000
committerpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2008-09-06 11:53:08 +0000
commitc038dc7514dbdaadcf867905b4ba718ad64cfb03 (patch)
tree6619af1683b54f4022ef70b33df2d7bf4d5cf123 /src/modules
parent0d6df835657bda160288fe8d9567381a25bac91e (diff)
use lock/unlock instead.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10404 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/extra/m_mssql.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/src/modules/extra/m_mssql.cpp b/src/modules/extra/m_mssql.cpp
index c59f02260..8f9f4b975 100644
--- a/src/modules/extra/m_mssql.cpp
+++ b/src/modules/extra/m_mssql.cpp
@@ -303,25 +303,25 @@ class SQLConn : public classbase
{
if (tds_process_simple_query(sock) != TDS_SUCCEED)
{
- LoggingMutex->Enable(true);
+ LoggingMutex->Lock();
Instance->Logs->Log("m_mssql",DEFAULT, "WARNING: Could not select database " + host.name + " for DB with id: " + host.id);
- LoggingMutex->Enable(false);
+ LoggingMutex->Unlock();
CloseDB();
}
}
else
{
- LoggingMutex->Enable(true);
+ LoggingMutex->Lock();
Instance->Logs->Log("m_mssql",DEFAULT, "WARNING: Could not select database " + host.name + " for DB with id: " + host.id);
- LoggingMutex->Enable(false);
+ LoggingMutex->Unlock();
CloseDB();
}
}
else
{
- LoggingMutex->Enable(true);
+ LoggingMutex->Lock();
Instance->Logs->Log("m_mssql",DEFAULT, "WARNING: Could not connect to DB with id: " + host.id);
- LoggingMutex->Enable(false);
+ LoggingMutex->Unlock();
CloseDB();
}
}
@@ -411,9 +411,9 @@ class SQLConn : public classbase
res->query = req.query.q;
char* msquery = strdup(req.query.q.data());
- LoggingMutex->Enable(true);
+ LoggingMutex->Lock();
Instance->Logs->Log("m_mssql",DEBUG,"doing Query: %s",msquery);
- LoggingMutex->Enable(false);
+ LoggingMutex->Unlock();
if (tds_submit_query(sock, msquery) != TDS_SUCCEED)
{
std::string error("failed to execute: "+std::string(req.query.q.data()));
@@ -481,9 +481,9 @@ class SQLConn : public classbase
break;
}
}
- ResultsMutex->Enable(true);
+ ResultsMutex->Lock();
results.push_back(res);
- ResultsMutex->Enable(false);
+ ResultsMutex->Unlock();
SendNotify();
return SQLerror();
}
@@ -491,18 +491,18 @@ class SQLConn : public classbase
static int HandleMessage(const TDSCONTEXT * pContext, TDSSOCKET * pTdsSocket, TDSMESSAGE * pMessage)
{
SQLConn* sc = (SQLConn*)pContext->parent;
- LoggingMutex->Enable(true);
+ LoggingMutex->Lock();
sc->Instance->Logs->Log("m_mssql", DEBUG, "Message for DB with id: %s -> %s", sc->host.id.c_str(), pMessage->message);
- LoggingMutex->Enable(false);
+ LoggingMutex->Unlock();
return 0;
}
static int HandleError(const TDSCONTEXT * pContext, TDSSOCKET * pTdsSocket, TDSMESSAGE * pMessage)
{
SQLConn* sc = (SQLConn*)pContext->parent;
- LoggingMutex->Enable(true);
+ LoggingMutex->Lock();
sc->Instance->Logs->Log("m_mssql", DEFAULT, "Error for DB with id: %s -> %s", sc->host.id.c_str(), pMessage->message);
- LoggingMutex->Enable(false);
+ LoggingMutex->Unlock();
return 0;
}
@@ -580,7 +580,7 @@ class SQLConn : public classbase
while (results.size())
{
MsSQLResult* res = results[0];
- ResultsMutex->Enable(true);
+ ResultsMutex->Lock();
if (res->GetDest())
{
res->Send();
@@ -594,7 +594,7 @@ class SQLConn : public classbase
delete res;
}
results.pop_front();
- ResultsMutex->Enable(false);
+ ResultsMutex->Unlock();
}
}
@@ -788,9 +788,9 @@ class ModuleMsSQL : public Module
{
if (HasHost(hi))
{
- LoggingMutex->Enable(true);
+ LoggingMutex->Lock();
ServerInstance->Logs->Log("m_mssql",DEFAULT, "WARNING: A MsSQL connection with id: %s already exists. Aborting database open attempt.", hi.id.c_str());
- LoggingMutex->Enable(false);
+ LoggingMutex->Unlock();
return;
}
@@ -828,9 +828,9 @@ class ModuleMsSQL : public Module
virtual void OnRehash(User* user, const std::string &parameter)
{
- QueueMutex->Enable(true);
+ QueueMutex->Lock();
ReadConf();
- QueueMutex->Enable(false);
+ QueueMutex->Unlock();
}
virtual const char* OnRequest(Request* request)
@@ -839,7 +839,7 @@ class ModuleMsSQL : public Module
{
SQLrequest* req = (SQLrequest*)request;
- QueueMutex->Enable(true);
+ QueueMutex->Lock();
ConnMap::iterator iter;
@@ -856,7 +856,7 @@ class ModuleMsSQL : public Module
req->error.Id(SQL_BAD_DBID);
}
- QueueMutex->Enable(false);
+ QueueMutex->Unlock();
return returnval;
}
@@ -888,7 +888,7 @@ void QueryThread::Run()
while (this->GetExitFlag() == false)
{
SQLConn* conn = NULL;
- QueueMutex->Enable(true);
+ QueueMutex->Lock();
for (ConnMap::iterator i = connections.begin(); i != connections.end(); i++)
{
if (i->second->queue.totalsize())
@@ -897,13 +897,13 @@ void QueryThread::Run()
break;
}
}
- QueueMutex->Enable(false);
+ QueueMutex->Unlock();
if (conn)
{
conn->DoLeadingQuery();
- QueueMutex->Enable(true);
+ QueueMutex->Lock();
conn->queue.pop();
- QueueMutex->Enable(false);
+ QueueMutex->Unlock();
}
usleep(1000);
}