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