Changeset 1988 for trunk


Ignore:
Timestamp:
Jun 5, 2005, 2:51:37 AM (20 years ago)
Author:
bird
Message:

HTIMER is 0 to 64k and global. Use ~0U for invalid handle. (untested)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/lib/sys/b_signalTimer.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r1987 r1988  
    6464static volatile unsigned        gfTerminate;
    6565/** Timer handle. */
    66 static volatile HTIMER          ghTimer;
     66static volatile HTIMER          ghTimer = ~0U;
    6767
    6868
     
    162162            {
    163163                __atomic_xchg(&gfOneShot, 0);
    164                 __atomic_xchg((volatile unsigned *)(void *)&ghTimer, 0);
     164                __atomic_xchg((volatile unsigned *)(void *)&ghTimer, ~0U);
    165165                if (guInterval)
    166166                {
     
    225225
    226226    /* kill timer. */
    227     HTIMER hTimer = ghTimer;
    228     if (hTimer)
    229     {
    230         ghTimer = NULLHANDLE;
     227    HTIMER hTimer = (HTIMER)__atomic_xchg((volatile unsigned *)(void *)&ghTimer, ~0U);
     228    if (hTimer != ~0U)
    231229        DosStopTimer(hTimer);
    232     }
    233230
    234231    __atomic_xchg(&gtidWorker, 0);
     
    273270
    274271        /* kill timer. */
    275         HTIMER hTimer = ghTimer;
    276         if (hTimer)
    277         {
    278             ghTimer = NULLHANDLE;
     272        HTIMER hTimer = (HTIMER)__atomic_xchg((volatile unsigned *)(void *)&ghTimer, ~0U);
     273        if (hTimer != ~0U)
    279274            DosStopTimer(hTimer);
    280         }
    281 
    282         /* kill the thread (it should've got the clue by now, but just in case) */
     275
     276        /* kill the thread (it should've taken the hints by now, but just in case) */
    283277        TID tid = gtidWorker;
    284278        if (tid)
     
    396390    {
    397391        __atomic_xchg(&gfArmed, 0);
    398         if (ghTimer)
    399         {
    400             HTIMER hTimer = ghTimer;
     392        HTIMER hTimer = (HTIMER)__atomic_xchg((volatile unsigned *)(void *)&ghTimer, ~0U);
     393        if (hTimer != ~0U)
    401394            rc = DosStopTimer(hTimer);
    402             ghTimer = NULLHANDLE;
    403         }
    404395    }
    405396
     
    438429            ghevTimer = NULLHANDLE;
    439430            gfTerminate = 0;
    440             ghTimer = NULLHANDLE;
     431            ghTimer = ~0U;
    441432            rc = DosCreateEventSem(NULL, (PHEV)&ghevTimer, DC_SEM_SHARED, FALSE);
    442433            if (!rc)
Note: See TracChangeset for help on using the changeset viewer.