1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-15 15:53:55 +00:00

1. Updated so that APCs are used for thread dispatching for Read/Exit on Windows

2. Updated to add support for child_process.waitExit() on Windows.
This commit is contained in:
Bryan Roe
2019-07-23 16:16:53 -07:00
parent 69fe1a74e4
commit 3efdc27478
3 changed files with 53 additions and 7 deletions

View File

@@ -1551,6 +1551,12 @@ void ILibProcessPipe_Process_OnExit_ChainSink(void *chain, void *user)
// We can't destroy this now, because we're on the MicrostackThread. We must destroy this on the WindowsRunLoop Thread.
QueueUserAPC((PAPCFUNC)ILibProcessPipe_Process_OnExit_ChainSink_DestroySink, j->parent->workerThread, (ULONG_PTR)j);
}
#ifdef WIN32
void __stdcall ILibProcessPipe_Process_OnExit_ChainSink_APC(ULONG_PTR obj)
{
ILibProcessPipe_Process_OnExit_ChainSink(NULL, (void*)obj);
}
#endif
BOOL ILibProcessPipe_Process_OnExit(HANDLE event, ILibWaitHandle_ErrorStatus errors, void* user)
{
ILibProcessPipe_Process_Object* j = (ILibProcessPipe_Process_Object*)user;
@@ -1566,8 +1572,12 @@ BOOL ILibProcessPipe_Process_OnExit(HANDLE event, ILibWaitHandle_ErrorStatus err
{
if (j->exitHandler != NULL)
{
// Everyone's lifes is made easier, by context switching to chain thread before making this call
// Everyone's lives will be made easier, by context switching to chain thread before making this call
#ifdef WIN32
QueueUserAPC((PAPCFUNC)ILibProcessPipe_Process_OnExit_ChainSink_APC, ILibChain_GetMicrostackThreadHandle(j->parent->ChainLink.ParentChain), (ULONG_PTR)user);
#else
ILibChain_RunOnMicrostackThread(j->parent->ChainLink.ParentChain, ILibProcessPipe_Process_OnExit_ChainSink, user);
#endif
}
else
{