Changeset 3849 for branches/libc-0.6/src


Ignore:
Timestamp:
Mar 16, 2014, 10:17:54 PM (11 years ago)
Author:
bird
Message:

fmutex: Don't panic on process exit (exit lists etc), also don't wait too long on mutexes during process exit since the owner might be dead. Fixes #256.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/libc-0.6/src/emx/src/lib/process/fmutex.c

    r3102 r3849  
    148148        for (;;)
    149149        {
    150             rc = DosWaitEventSem(sem->hev, sem->flags & _FMC_SHARED ? SEM_INDEFINITE_WAIT : 3000);
     150            ULONG cMsWait = sem->flags & _FMC_SHARED ? SEM_INDEFINITE_WAIT : 3000;
     151            if (fibIsInExit())
     152                cMsWait = 250;
     153            rc = DosWaitEventSem(sem->hev, cMsWait);
    151154            if (rc == ERROR_INTERRUPT)
    152155            {
     
    165168            if (rc != ERROR_TIMEOUT)
    166169                break;
     170
    167171            /*
    168172             * Deadlock detection - check if owner is around.
     
    179183            }
    180184        }
     185
    181186        FS_RESTORE();
    182187        if (rc != 0)
     
    284289        for (;;)
    285290        {
    286             DosExitMustComplete(&ulNesting);
    287             rc = DosWaitEventSem(sem->hev, sem->flags & _FMC_SHARED ? SEM_INDEFINITE_WAIT : 3000);
     291            ULONG cMsWait = sem->flags & _FMC_SHARED ? SEM_INDEFINITE_WAIT : 3000;
     292            if (fibIsInExit())
     293                cMsWait = 250;
     294            DosExitMustComplete(&ulNesting);
     295            rc = DosWaitEventSem(sem->hev, cMsWait);
    288296            DosEnterMustComplete(&ulNesting);
    289297            if (rc == ERROR_INTERRUPT)
     
    303311            if (rc != ERROR_TIMEOUT)
    304312                break;
     313
    305314            /*
    306315             * Deadlock detection - check if owner is around.
     
    319328            }
    320329        }
     330
    321331        FS_RESTORE();
    322332        if (rc != 0)
     
    331341static void __fmutex_deadlock(_fmutex *pSem, const char *pszMsg)
    332342{
    333     __libc_Back_panic(0, NULL,
    334                       "fmutex deadlock: %s\n"
    335                       "%x: Owner=%x Self=%x fs=%x flags=%x hev=%x\n"
    336                       "            Desc=\"%s\"\n",
    337                       pszMsg,
    338                       pSem, pSem->Owner, fibGetTidPid(), pSem->fs, pSem->flags, pSem->hev,
    339                       pSem->pszDesc);
     343    if (!fibIsInExit())
     344        __libc_Back_panic(0, NULL,
     345                          "fmutex deadlock: %s\n"
     346                          "%x: Owner=%x Self=%x fs=%x flags=%x hev=%x\n"
     347                          "            Desc=\"%s\"\n",
     348                          pszMsg,
     349                          pSem, pSem->Owner, fibGetTidPid(), pSem->fs, pSem->flags, pSem->hev,
     350                          pSem->pszDesc);
    340351}
    341352
     
    377388    {
    378389        FS_RESTORE();
    379         LIBCLOG_RETURN_UINT(rc);
     390        LIBCLOG_ERROR_RETURN_UINT(rc);
    380391    }
    381392
Note: See TracChangeset for help on using the changeset viewer.