Changeset 3371 for branches


Ignore:
Timestamp:
May 27, 2007, 8:37:38 AM (18 years ago)
Author:
bird
Message:

perhaps we should exit all MCs before comitting suicide?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/libc-0.6/src/emx/src/lib/sys/logstrict.c

    r2796 r3371  
    611611static void __libc_logWrite(__LIBC_PLOGINST pInst, unsigned fGroupAndFlags, const char *pszMsg, size_t cch, int fStdErr)
    612612{
    613     APIRET  rc;
     613    APIRET  rcSem;
     614    APIRET  rcMC;
     615    ULONG   ulIgnore = 0;
    614616    ULONG   cb = 0;
    615617    HMTX    hmtx = pInst->hmtx;
     
    619621    /*
    620622     * Aquire mutex ownership.
    621      */
    622     rc = DosRequestMutexSem(hmtx, SEM_INDEFINITE_WAIT);
    623     switch (rc)
    624     {
    625         case 0:
     623     * We enter a must-complete section here to avoid getting interrupted
     624     * while writing and creating deadlocks.
     625     */
     626    rcMC = DosEnterMustComplete(&ulIgnore);
     627    rcSem = DosRequestMutexSem(hmtx, 5000);
     628    switch (rcSem)
     629    {
     630        case NO_ERROR:
    626631            break;
     632
    627633        /* recreate the semaphore for some odd. */
    628634        case ERROR_INVALID_HANDLE:
     
    630636        {
    631637            HMTX    hmtxNew;
    632             rc = DosCreateMutexSem(NULL, &hmtxNew, 0, TRUE);
    633             if (!rc)
     638            rcSem = DosCreateMutexSem(NULL, &hmtxNew, 0, TRUE);
     639            if (!rcSem)
    634640            {
    635641                hmtx = __lxchg((int*)&pInst->hmtx, hmtxNew);
     
    647653    if (fGroupAndFlags & __LIBC_LOG_MSGF_FLUSH)
    648654        DosResetBuffer(pInst->hFile);
    649     if (!rc)
     655    if (!rcSem)
    650656        DosReleaseMutexSem(pInst->hmtx);
     657    if (!rcMC)
     658        DosExitMustComplete(&ulIgnore);
    651659    FS_RESTORE();
    652660
Note: See TracChangeset for help on using the changeset viewer.