1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-06 18:43:46 +00:00

1. Added additional memory check helpers

2. Updated Process exit detection to check apc flags
This commit is contained in:
Bryan Roe
2020-04-19 15:18:52 -07:00
parent 72cbf91686
commit 0c6db0b2a6
5 changed files with 35 additions and 4 deletions

View File

@@ -279,9 +279,9 @@ void __stdcall ILibDuktape_readableStream_WriteData_OnData_ChainThread_APC(ULONG
ILibDuktape_readableStream_bufferedData *data = (ILibDuktape_readableStream_bufferedData*)obj;
void *chain = ((void**)ILibMemory_GetExtraMemory((void*)obj, sizeof(ILibDuktape_readableStream_bufferedData) + data->bufferLen))[0];
if (ILibChain_SelectInterrupted(chain) != 0)
if (duk_ctx_context_data(data->ctx)->apc_flags == 0)
{
// This APC interrupted a winsock (select) call, so we must unroll the callstack to continue,
// This APC interrupted an unknown alertable method, so we must unroll the callstack to continue,
// because winsock is not re-entrant, so we cannot risk making another winsock call directly.
//
Duktape_RunOnEventLoop(chain, duk_ctx_nonce(data->ctx), data->ctx, ILibDuktape_readableStream_WriteData_OnData_ChainThread, NULL, (void*)obj);