Ignore:
Timestamp:
Jan 29, 2003, 7:41:39 PM (23 years ago)
Author:
umoeller
Message:

New build system, multimedia, other misc fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/sem.c

    r196 r243  
    22/*
    33 *@@sourcefile sem.c:
    4  *      implements fast mutex semaphores a la Win32
    5  *      critical sections.
    6  *
    7  *      This is an OS/2 implementation of what Win32 calls as
    8  *      "critical sections"
    9  *      It is an implementation that is highly optimized for
     4 *      implements fast mutex semaphores.
     5 *
     6 *      This is an OS/2 implementation of what Win32 calls
     7 *      "critical sections". This is highly optimized for
    108 *      the case where there is only one thread trying to
    119 *      access the critical section, i.e. it is available most
     
    194192    // do an atomic increase of the lockcounter and see if it is > 0
    195193    // (i.e. it is already posessed)
    196     if (DosInterlockedIncrement(&pmtx->LockCount))
     194    if (lockIncrement(&pmtx->LockCount))
    197195    {
    198196        // semaphore was already requested:
     
    206204        }
    207205
    208         // current owner is different thread thread:
     206        // current owner is different thread:
    209207
    210208        // do an atomic operation where we compare the owning thread id with 0
    211209        // and if this is true, exchange it with the id of the current thread
    212         if (DosInterlockedCompareExchange((PLONG)&pmtx->OwningThread, threadid, 0))
     210        if (lockCompareExchange((PLONG)&pmtx->OwningThread, threadid, 0))
    213211        {
    214212            // the compare did not return equal, i.e. the pmtx sect is in use
     
    257255BOOL semTry(PFASTMTX pmtx)
    258256{
    259     if (DosInterlockedIncrement(&pmtx->LockCount))
     257    if (lockIncrement(&pmtx->LockCount))
    260258    {
    261259        if (pmtx->OwningThread == GetTID())
     
    265263        }
    266264
    267         DosInterlockedDecrement(&pmtx->LockCount);
     265        lockDecrement(&pmtx->LockCount);
    268266
    269267        return FALSE;
     
    291289    if (--pmtx->RecursionCount)
    292290    {
    293         DosInterlockedDecrement(&pmtx->LockCount );
     291        lockDecrement(&pmtx->LockCount );
    294292        return NO_ERROR;
    295293    }
     
    297295    pmtx->OwningThread = 0;
    298296
    299     if (DosInterlockedDecrement(&pmtx->LockCount) >= 0)
     297    if (lockDecrement(&pmtx->LockCount) >= 0)
    300298        // someone is waiting
    301299        DosPostEventSem(pmtx->hmtxLock);
Note: See TracChangeset for help on using the changeset viewer.