diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2016-05-07 15:38:25 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2016-05-07 15:38:25 +0000 |
commit | 0d3b1e2959bdf303c9e60bc9d3940e51e5e3e1d1 (patch) | |
tree | 0c3b11fc01cef6dedaf925692ceba0847e6d1cd8 /plugins/Dbx_mdb/src/dbcontacts.cpp | |
parent | 9cd2417aa9352b4f41cd3abf2ff54b6457b053fb (diff) |
dbx_lmdb: optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@16813 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb/src/dbcontacts.cpp')
-rw-r--r-- | plugins/Dbx_mdb/src/dbcontacts.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/plugins/Dbx_mdb/src/dbcontacts.cpp b/plugins/Dbx_mdb/src/dbcontacts.cpp index 68a063519e..a4f6e2ac74 100644 --- a/plugins/Dbx_mdb/src/dbcontacts.cpp +++ b/plugins/Dbx_mdb/src/dbcontacts.cpp @@ -42,7 +42,6 @@ int CDbxMdb::CheckProto(DBCachedContact *cc, const char *proto) STDMETHODIMP_(LONG) CDbxMdb::GetContactCount(void)
{
- mir_cslock lck(m_csDbAccess);
return m_contactCount;
}
@@ -92,7 +91,6 @@ STDMETHODIMP_(LONG) CDbxMdb::DeleteContact(MCONTACT contactID) NotifyEventHooks(hContactDeletedEvent, contactID, 0);
- mir_cslock lck(m_csDbAccess);
{
OBJLIST<EventItem> events(50);
@@ -133,7 +131,7 @@ STDMETHODIMP_(LONG) CDbxMdb::DeleteContact(MCONTACT contactID) break;
}
- m_contactCount--;
+ InterlockedDecrement(&m_contactCount);
m_cache->FreeCachedContact(contactID);
if (contactID == m_hLastCachedContact)
@@ -146,8 +144,7 @@ STDMETHODIMP_(MCONTACT) CDbxMdb::AddContact() {
DWORD dwContactId;
{
- mir_cslock lck(m_csDbAccess);
- dwContactId = ++m_dwMaxContactId;
+ dwContactId = InterlockedIncrement(&m_dwMaxContactId);
DBCachedContact *cc = m_cache->AddContactToCache(dwContactId);
cc->dbc.dwSignature = DBCONTACT_SIGNATURE;
@@ -161,7 +158,7 @@ STDMETHODIMP_(MCONTACT) CDbxMdb::AddContact() if (trnlck.commit())
break;
}
- m_contactCount++;
+ InterlockedIncrement(&m_contactCount);
}
NotifyEventHooks(hContactAddedEvent, dwContactId, 0);
@@ -312,8 +309,6 @@ void CDbxMdb::FillContacts() LIST<DBCachedContact> arContacts(10);
{
- mir_cslock lck(m_csDbAccess);
-
txn_ptr_ro trnlck(m_txn);
cursor_ptr_ro cursor(m_curContacts);
|