Changeset 3102 for branches


Ignore:
Timestamp:
Apr 15, 2007, 5:27:12 AM (19 years ago)
Author:
bird
Message:

workaround for lost signals / thread pokes. Fixes #152.

Location:
branches/libc-0.6/src/emx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/libc-0.6/src/emx/include/InnoTekLIBC/backend.h

    r2439 r3102  
    816816int __libc_Back_signalTimer(int iWhich, const struct itimerval *pValue, struct itimerval *pOldValue);
    817817
     818
     819
     820
     821
     822
     823
     824
     825
    818826
    819827
  • branches/libc-0.6/src/emx/src/lib/libc.def

    r2896 r3102  
    19581958    "__std_nanf" @1956
    19591959    "__std_nanl" @1957
     1960
    19601961
     1962
  • branches/libc-0.6/src/emx/src/lib/process/fmutex.c

    r2282 r3102  
    1717#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MUTEX
    1818#include <InnoTekLIBC/logstrict.h>
     19
    1920#include <InnoTekLIBC/backend.h>
    2021
     
    200201    FS_SAVE_LOAD();
    201202    DosEnterMustComplete(&ulNesting);
     203
     204
     205
     206
     207
     208
     209
     210
     211
     212
    202213    fs = __cxchg(&sem->fs, _FMS_OWNED_SIMPLE);
    203214    if (fs == _FMS_AVAILABLE)
     
    214225        if (rc)
    215226        {
     227
    216228            LIBC_ASSERTM_FAILED("Failed to create event semaphore for fmutex '%s', rc=%d. flags=%#x\n", sem->pszDesc, rc, sem->flags);
    217229            FS_RESTORE();
     
    332344    LIBCLOG_ENTER("sem=%p{.pszDesc=%s}\n", (void *)sem, sem->pszDesc);
    333345    ULONG ulNesting;
     346
     347
    334348    __atomic_xchg(&sem->Owner, 0);
    335349    signed char fs = __cxchg(&sem->fs, _FMS_AVAILABLE);
    336     if (fs != _FMS_OWNED_HARD)
    337     {
    338         FS_VAR_SAVE_LOAD();
    339         DosExitMustComplete(&ulNesting);
    340         FS_RESTORE();
    341         LIBCLOG_RETURN_UINT(0);
    342     }
    343     else
    344     {
    345         int rc = __fmutex_release_internal (sem);
    346         FS_VAR_SAVE_LOAD();
    347         DosExitMustComplete(&ulNesting);
    348         FS_RESTORE();
    349         LIBCLOG_RETURN_UINT(rc);
    350     }
     350    if (fs == _FMS_OWNED_HARD)
     351        rc = __fmutex_release_internal (sem);
     352
     353    FS_VAR_SAVE_LOAD();
     354    DosExitMustComplete(&ulNesting);
     355    FS_RESTORE();
     356
     357    /* This is a hack to catch lost poke signals. */
     358    if (!ulNesting)
     359    {
     360        __LIBC_PTHREAD pThrd = __libc_threadCurrentNoAuto();
     361        if (pThrd && pThrd->fSigBeingPoked)
     362            __libc_Back_signalLostPoke();
     363    }
     364
     365    LIBCLOG_RETURN_UINT(rc);
    351366}
    352367
  • branches/libc-0.6/src/emx/src/lib/sys/signals.c

    r2518 r3102  
    24782478    if (!pThrdPoke->fSigBeingPoked)
    24792479    {
     2480
    24802481        __atomic_xchg(&pThrdPoke->fSigBeingPoked, 1);
    24812482        int rc = DosKillThread(pThrdPoke->tid);
     2483
    24822484        if (rc)
     2485
     2486
    24832487            LIBC_ASSERTM_FAILED("DosKillThread(%d) -> rc=%d\n", pThrdPoke->tid, rc);
     2488
    24842489    }
    24852490
     
    25322537
    25332538    return -EINVAL;
     2539
     2540
     2541
     2542
     2543
     2544
     2545
     2546
     2547
     2548
     2549
     2550
     2551
     2552
     2553
     2554
     2555
     2556
     2557
     2558
     2559
     2560
     2561
     2562
     2563
     2564
     2565
     2566
     2567
     2568
     2569
     2570
     2571
     2572
     2573
     2574
     2575
     2576
     2577
     2578
     2579
     2580
     2581
     2582
     2583
     2584
    25342585}
    25352586
Note: See TracChangeset for help on using the changeset viewer.