1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-22 03:03:18 +00:00

untested changes

This commit is contained in:
Bryan Roe
2020-05-06 14:03:41 -07:00
parent 5fb0cef7db
commit 47066bd825
3 changed files with 61 additions and 62 deletions

View File

@@ -2862,14 +2862,24 @@ void __stdcall ILibChain_RemoveWaitHandle_APC(ULONG_PTR u)
}
void ILibChain_RemoveWaitHandle(void *chain, HANDLE h)
{
//
// We must dispatch an APC to remove the wait handle,
// because we can't change the wait list during a WaitForMultipleObjectsEx() call
//
void **tmp = (void**)ILibMemory_SmartAllocate(2 * sizeof(void*));
tmp[0] = chain;
tmp[1] = h;
QueueUserAPC((PAPCFUNC)ILibChain_RemoveWaitHandle_APC, ILibChain_GetMicrostackThreadHandle(chain), (ULONG_PTR)tmp);
if (ILibIsRunningOnChainThread(chain))
{
void *tmp[2];
tmp[0] = chain;
tmp[1] = h;
ILibChain_RemoveWaitHandle_APC((ULONG_PTR)tmp);
}
else
{
//
// We must dispatch an APC to remove the wait handle,
// because we can't change the wait list during a WaitForMultipleObjectsEx() call
//
void **tmp = (void**)ILibMemory_SmartAllocate(2 * sizeof(void*));
tmp[0] = chain;
tmp[1] = h;
QueueUserAPC((PAPCFUNC)ILibChain_RemoveWaitHandle_APC, ILibChain_GetMicrostackThreadHandle(chain), (ULONG_PTR)tmp);
}
}
#endif