MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / AddToThreadQueue

Method AddToThreadQueue

core/logic/Database.cpp:391–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389static IdentityToken_t *s_pAddBlock = NULL;
390
391bool DBManager::AddToThreadQueue(IDBThreadOperation *op, PrioQueueLevel prio)
392{
393 if (s_pAddBlock && op->GetOwner() == s_pAddBlock)
394 {
395 return false;
396 }
397
398 if (!m_Worker)
399 {
400 m_Worker = ke::NewThread("SM Database Worker", [this]() -> void {
401 Run();
402 });
403 }
404
405 /* Add to the queue */
406 {
407 std::lock_guard<std::mutex> lock(m_Lock);
408 Queue<IDBThreadOperation *> &queue = m_OpQueue.GetQueue(prio);
409 queue.push(op);
410 m_QueueEvent.notify_one();
411 }
412
413 return true;
414}
415
416void DBManager::Run()
417{

Callers 7

ConnectToDbAsyncFunction · 0.80
SQL_TQueryFunction · 0.80
SQL_ExecuteTransactionFunction · 0.80
SDK_OnLoadMethod · 0.80
AttemptReconnectionMethod · 0.80
AddQueryToQueueMethod · 0.80
ProcessQueryCacheMethod · 0.80

Calls 2

GetOwnerMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected