Replace all uses of AMTL threads with STL threads.

This also rewrites the work loop for threaded queries. It has been
simplified significantly.
This commit is contained in:
David Anderson
2020-05-16 22:35:56 -07:00
parent 15023777f4
commit a253e175bb
16 changed files with 84 additions and 98 deletions
+4 -5
View File
@@ -297,7 +297,7 @@ void ClientPrefs::DatabaseConnect()
// Need a new scope because of the goto above.
{
AutoLock lock(&queryLock);
std::lock_guard<std::mutex> lock(queryLock);
this->ProcessQueryCache();
}
return;
@@ -310,7 +310,7 @@ fatal_fail:
bool ClientPrefs::AddQueryToQueue(TQueryOp *query)
{
{
AutoLock lock(&queryLock);
std::lock_guard<std::mutex> lock(queryLock);
if (!Database)
{
cachedQueries.append(query);
@@ -328,8 +328,6 @@ bool ClientPrefs::AddQueryToQueue(TQueryOp *query)
void ClientPrefs::ProcessQueryCache()
{
queryLock.AssertCurrentThreadOwns();
if (!Database)
return;
@@ -373,7 +371,8 @@ void ClientPrefs::CatchLateLoadClients()
void ClientPrefs::ClearQueryCache(int serial)
{
AutoLock lock(&queryLock);
std::lock_guard<std::mutex> lock(queryLock);
for (size_t iter = 0; iter < cachedQueries.length(); ++iter)
{
TQueryOp *op = cachedQueries[iter];
+2 -2
View File
@@ -37,8 +37,8 @@
#include "smsdk_ext.h"
#include "am-vector.h"
#include <am-thread-utils.h>
#include <am-refcounting.h>
#include <mutex>
char * UTIL_strncpy(char * destination, const char * source, size_t num);
@@ -159,7 +159,7 @@ public:
private:
ke::Vector<TQueryOp *> cachedQueries;
ke::Mutex queryLock;
std::mutex queryLock;
IdentityToken_t *identity;
};