Changeset 3371 for trunk


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
  • trunk/libc/src/kNIX/os2/logstrict.c

    r2929 r3371  
    592592static void __libc_logWrite(__LIBC_PLOGINST pInst, unsigned fGroupAndFlags, const char *pszMsg, size_t cch, int fStdErr)
    593593{
    594     APIRET  rc;
     594    APIRET  rcSem;
     595    APIRET  rcMC;
     596    ULONG   ulIgnore = 0;
    595597    ULONG   cb = 0;
    596598    HMTX    hmtx = pInst->hmtx;
     
    600602    /*
    601603     * Aquire mutex ownership.
    602      */
    603     rc = DosRequestMutexSem(hmtx, SEM_INDEFINITE_WAIT);
    604     switch (rc)
    605     {
    606         case 0:
     604     * We enter a must-complete section here to avoid getting interrupted
     605     * while writing and creating deadlocks.
     606     */
     607    rcMC = DosEnterMustComplete(&ulIgnore);
     608    rcSem = DosRequestMutexSem(hmtx, 5000);
     609    switch (rcSem)
     610    {
     611        case NO_ERROR:
    607612            break;
     613
    608614        /* recreate the semaphore for some odd. */
    609615        case ERROR_INVALID_HANDLE:
     
    611617        {
    612618            HMTX    hmtxNew;
    613             rc = DosCreateMutexSem(NULL, &hmtxNew, 0, TRUE);
    614             if (!rc)
     619            rcSem = DosCreateMutexSem(NULL, &hmtxNew, 0, TRUE);
     620            if (!rcSem)
    615621            {
    616622                hmtx = __lxchg((int*)&pInst->hmtx, hmtxNew);
     
    628634    if (fGroupAndFlags & __LIBC_LOG_MSGF_FLUSH)
    629635        DosResetBuffer(pInst->hFile);
    630     if (!rc)
     636    if (!rcSem)
    631637        DosReleaseMutexSem(pInst->hmtx);
     638    if (!rcMC)
     639        DosExitMustComplete(&ulIgnore);
    632640    FS_RESTORE();
    633641
Note: See TracChangeset for help on using the changeset viewer.