mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 10:35:11 -04:00
C client: Fix crash on process exit on linux
This commit is contained in:
parent
cd1961f588
commit
a88d912859
@ -235,20 +235,21 @@ static void AsyncDownloader_CompleteResult(struct AsyncRequest* request) {
|
||||
}
|
||||
|
||||
static void AsyncDownloader_WorkerFunc(void) {
|
||||
while (true) {
|
||||
for (;;) {
|
||||
struct AsyncRequest request;
|
||||
bool hasRequest = false;
|
||||
bool hasRequest = false, stop;
|
||||
|
||||
Mutex_Lock(async_pendingMutex);
|
||||
{
|
||||
if (async_terminate) return;
|
||||
if (async_pending.Count) {
|
||||
stop = async_terminate;
|
||||
if (!stop && async_pending.Count) {
|
||||
request = async_pending.Requests[0];
|
||||
hasRequest = true;
|
||||
AsyncRequestList_RemoveAt(&async_pending, 0);
|
||||
}
|
||||
}
|
||||
Mutex_Unlock(async_pendingMutex);
|
||||
if (stop) return;
|
||||
|
||||
if (hasRequest) {
|
||||
Platform_LogConst("Got something to do!");
|
||||
@ -283,8 +284,8 @@ static void AsyncDownloader_Init(void) {
|
||||
Http_Init();
|
||||
|
||||
async_waitable = Waitable_Create();
|
||||
async_pendingMutex = Mutex_Create();
|
||||
async_processedMutex = Mutex_Create();
|
||||
async_pendingMutex = Mutex_Create();
|
||||
async_processedMutex = Mutex_Create();
|
||||
async_curRequestMutex = Mutex_Create();
|
||||
async_workerThread = Thread_Start(AsyncDownloader_WorkerFunc, false);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user