Changeset 3173 for trunk/src/kmk/w32


Ignore:
Timestamp:
Mar 21, 2018, 10:37:41 PM (8 years ago)
Author:
bird
Message:

kmkbultin: environment fixes and stats.

Location:
trunk/src/kmk/w32
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/w32/w32os.c

    r3156 r3173  
    187187    /* Build array of handles to wait for.  */
    188188    dwHandleCount = 1 + process_set_handles (&handles[1]);
    189 #else
    190     /* Add the completed children event as the 2nd one. */
    191     handles[1] = (HANDLE)MkWinChildGetCompleteEventHandle();
    192     dwHandleCount = 2;
    193 #endif
    194 
    195189    dwEvent = WaitForMultipleObjects (
    196190        dwHandleCount,  /* number of objects in array */
     
    198192        FALSE,          /* wait for any object */
    199193        INFINITE);      /* wait until object is signalled */
     194#else
     195    /* Add the completed children event as the 2nd one. */
     196    handles[1] = (HANDLE)MkWinChildGetCompleteEventHandle();
     197    if (handles[1] == NULL)
     198      return 0;
     199    dwHandleCount = 2;
     200    dwEvent = WaitForMultipleObjectsEx (dwHandleCount,
     201                                        handles,
     202                                        FALSE /*bWaitAll*/,
     203                                        256, /* INFINITE - paranoia, only wait 256 ms before checking again. */
     204                                        TRUE /*bAlertable*/);
     205#endif
    200206
    201207    if (dwEvent == WAIT_FAILED)
  • trunk/src/kmk/w32/winchildren.c

    r3172 r3173  
    25362536 * that completed children is the typical source of these tokens (esp. for kmk).
    25372537 *
    2538  * @returns Event handle.
     2538 * @returns Zero if completed children, event handle if waiting is required.
    25392539 */
    25402540intptr_t MkWinChildGetCompleteEventHandle(void)
    25412541{
    2542     return (intptr_t)g_hEvtWaitChildren;
     2542    /* We don't return the handle if we've got completed children.  This
     2543       is a safe guard against being called twice in a row without any
     2544       MkWinChildWait call inbetween. */
     2545    if (!g_pTailCompletedChildren)
     2546        return (intptr_t)g_hEvtWaitChildren;
     2547    return 0;
    25432548}
    25442549
Note: See TracChangeset for help on using the changeset viewer.