mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-07 10:28:34 +00:00
Fixed release build
This commit is contained in:
parent
3b026e2bd4
commit
1f479a72c3
@ -594,10 +594,7 @@ void HTTPSessionManager::PluginUnloaded(IPlugin *plugin)
|
||||
}
|
||||
|
||||
// Wait for running requests to finish
|
||||
{
|
||||
ke::AutoTryLock lock(&threads_);
|
||||
|
||||
if (threads_.Locked())
|
||||
if (threads_.DoTryLock())
|
||||
{
|
||||
if (!threads.empty())
|
||||
{
|
||||
@ -610,7 +607,6 @@ void HTTPSessionManager::PluginUnloaded(IPlugin *plugin)
|
||||
i = this->threads.erase(i);
|
||||
|
||||
// Check for pending callbacks and cancel them
|
||||
{
|
||||
ke::AutoLock lock(&callbacks_);
|
||||
|
||||
if (!callbacks.empty())
|
||||
@ -630,8 +626,8 @@ void HTTPSessionManager::PluginUnloaded(IPlugin *plugin)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
threads_.DoUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
@ -696,9 +692,7 @@ void HTTPSessionManager::BurnSessionHandle(IPluginContext *pCtx,
|
||||
void HTTPSessionManager::RunFrame()
|
||||
{
|
||||
// Try to execute pending callbacks
|
||||
{
|
||||
ke::AutoTryLock lock(&callbacks_);
|
||||
if (this->callbacks_.Locked())
|
||||
if (callbacks_.DoTryLock())
|
||||
{
|
||||
if (!this->callbacks.empty())
|
||||
{
|
||||
@ -727,13 +721,12 @@ void HTTPSessionManager::RunFrame()
|
||||
|
||||
this->callbacks.pop();
|
||||
}
|
||||
}
|
||||
|
||||
callbacks_.DoUnlock();
|
||||
}
|
||||
|
||||
// Try to fire up some new asynchronous requests
|
||||
{
|
||||
ke::AutoTryLock lock(&requests_);
|
||||
if (requests_.Locked())
|
||||
if (requests_.DoTryLock())
|
||||
{
|
||||
// NOTE: this is my "burst thread creation" solution
|
||||
// Using a thread pool is slow as it executes the threads
|
||||
@ -756,14 +749,14 @@ void HTTPSessionManager::RunFrame()
|
||||
IThreadHandle *pThread =
|
||||
threader->MakeThread(async, Thread_Default);
|
||||
// Save thread handle
|
||||
//this->threads.push_front(pThread);
|
||||
this->threads.append(pThread);
|
||||
}
|
||||
// Remove request as it's being handled now
|
||||
this->requests.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
requests_.DoUnlock();
|
||||
}
|
||||
|
||||
// Do some quick "garbage collection" on finished threads
|
||||
@ -784,16 +777,13 @@ void HTTPSessionManager::Shutdown()
|
||||
|
||||
void HTTPSessionManager::AddCallback(HTTPRequest request)
|
||||
{
|
||||
{
|
||||
ke::AutoLock lock(&callbacks_);
|
||||
this->callbacks.append(request);
|
||||
}
|
||||
}
|
||||
|
||||
void HTTPSessionManager::RemoveFinishedThreads()
|
||||
{
|
||||
ke::AutoLock lock(&threads_);
|
||||
if (threads_.Locked())
|
||||
if (threads_.DoTryLock())
|
||||
{
|
||||
if (!this->threads.empty())
|
||||
{
|
||||
@ -809,6 +799,8 @@ void HTTPSessionManager::RemoveFinishedThreads()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
threads_.DoUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user