VirtualBox

Changeset 3460 in kBuild for trunk/src/kash/shinstance.h


Ignore:
Timestamp:
Sep 15, 2020 12:31:01 PM (5 years ago)
Author:
bird
Message:

kash: Use event semaphores to signal parent shell early before the subshell thread has performed cleanups.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kash/shinstance.h

    r3459 r3460  
    6464#endif
    6565
     66#ifndef SH_FORKED_MODE
     67/**
     68 * Subshell status.
     69 */
     70typedef struct shsubshellstatus
     71{
     72    unsigned volatile   refs;           /**< Reference counter. */
     73    int volatile        status;         /**< The exit code. */
     74    KBOOL volatile      done;           /**< Set if done (valid exit code). */
     75    void               *towaiton;       /**< Event semaphore / whatever to wait on. */
     76# if K_OS == K_OS_WINDOWS
     77    uintptr_t volatile  hThread;        /**< The thread handle (child closes this). */
     78# endif
     79    struct shsubshellstatus *next;      /**< Next free one on the free chain. */
     80} shsubshellstatus;
     81#endif
     82
    6683/**
    6784 * A child process.
     
    6986typedef struct shchild
    7087{
    71     shpid       pid;                    /**< The pid. */
     88    shpid               pid;            /**< The pid. */
    7289#if K_OS == K_OS_WINDOWS
    73     void       *hChild;                 /**< The process handle. */
     90    void               *hChild;         /**< The handle to wait on. */
    7491#endif
    7592#ifndef SH_FORKED_MODE
    76     KBOOL       fProcess;               /**< Set if process, clear if internal thread. */
     93    shsubshellstatus   *subshellstatus; /**< Pointer to the subshell status structure.  NULL if child process. */
    7794#endif
    7895} shchild;
     
    215232    void               *threadarg;      /**< The thread argument. */
    216233    struct jmploc      *exitjmp;        /**< Long jump target in sh_thread_wrapper for use by sh__exit. */
     234    shsubshellstatus   *subshellstatus; /**< Pointer to the subshell status structure (NULL if root). */
    217235#endif
    218236
     
    496514
    497515/* wait / process */
    498 int sh_add_child(shinstance *psh, shpid pid, void *hChild, KBOOL fProcess);
     516int sh_add_child(shinstance *psh, shpid pid, void *hChild, shsubshellstatus *sts);
    499517#ifdef _MSC_VER
    500518#   include <process.h>
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette