Changeset 9331 for trunk/src


Ignore:
Timestamp:
Oct 7, 2002, 6:28:15 PM (23 years ago)
Author:
sandervl
Message:

Minor updates for critical section functions

Location:
trunk/src/odincrt
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/odincrt/critsect.cpp

    r8902 r9331  
    1 /* $Id: critsect.cpp,v 1.5 2002-07-22 05:58:02 achimha Exp $ */
     1/* $Id: critsect.cpp,v 1.6 2002-10-07 16:28:13 sandervl Exp $ */
    22/*
    33 * Critical sections in the Win32 sense
     
    7272 *           DosInitializeCriticalSection
    7373 */
    74 VOID WIN32API DosInitializeCriticalSection(CRITICAL_SECTION_OS2 *crit, PSZ pszSemName)
     74ULONG WIN32API DosInitializeCriticalSection(CRITICAL_SECTION_OS2 *crit, PSZ pszSemName)
    7575{
    7676    APIRET rc;
     
    8585        DebugInt3();
    8686        crit->hmtxLock = 0;
     87        return rc;
    8788    }
    8889    crit->Reserved       = GetCurrentProcessId();
     90    return NO_ERROR;
    8991}
    9092
     
    9395 *           DosAccessCriticalSection
    9496 */
    95 VOID WIN32API DosAccessCriticalSection(CRITICAL_SECTION_OS2 *, PSZ pszSemName)
     97ULONG WIN32API DosAccessCriticalSection(CRITICAL_SECTION_OS2 *, PSZ pszSemName)
    9698{
    9799    HMTX   hmtxLock = 0;
     
    100102    if(pszSemName == NULL) {
    101103        DebugInt3();
    102         return;
     104        return ERROR_INVALID_PARAMETER;
    103105    }
    104106
     
    106108    if(rc != NO_ERROR) {
    107109        DebugInt3();
    108     }
     110        return rc;
     111    }
     112    return NO_ERROR;
    109113}
    110114/***********************************************************************
    111115 *           DosDeleteCriticalSection
    112116 */
    113 void WIN32API DosDeleteCriticalSection( CRITICAL_SECTION_OS2 *crit )
     117ULONG WIN32API DosDeleteCriticalSection( CRITICAL_SECTION_OS2 *crit )
    114118{
    115119    if (crit->hmtxLock)
     
    126130        crit->Reserved       = (DWORD)-1;
    127131    }
     132    return NO_ERROR;
    128133}
    129134
     
    132137 *           DosEnterCriticalSection
    133138 */
    134 void WIN32API DosEnterCriticalSection( CRITICAL_SECTION_OS2 *crit )
     139ULONG WIN32API DosEnterCriticalSection( CRITICAL_SECTION_OS2 *crit, ULONG ulTimeout )
    135140{
    136141    DWORD res;
     
    151156        {
    152157            crit->RecursionCount++;
    153             return;
     158            return NO_ERROR;
    154159        }
    155160        // do an atomic operation where we compare the owning thread id with 0
     
    162167
    163168            /* Now wait for it */
    164             APIRET rc = DosWaitEventSem(crit->hmtxLock, SEM_INDEFINITE_WAIT);
     169            APIRET rc = DosWaitEventSem(crit->hmtxLock, ulTimeout);
    165170            if(rc != NO_ERROR) {
    166171                DebugInt3();
    167                 return;
     172                return rc;
    168173            }
    169174            DosResetEventSem(crit->hmtxLock, &ulnrposts);
     
    175180    crit->OwningThread   = GetCurrentThreadId();
    176181    crit->RecursionCount = 1;
     182    return NO_ERROR;
    177183}
    178184
     
    202208 *           DosLeaveCriticalSection
    203209 */
    204 void WIN32API DosLeaveCriticalSection( CRITICAL_SECTION_OS2 *crit )
    205 {
    206     if (crit->OwningThread != GetCurrentThreadId()) return;
     210ULONG WIN32API DosLeaveCriticalSection( CRITICAL_SECTION_OS2 *crit )
     211{
     212    if (crit->OwningThread != GetCurrentThreadId()) {
     213        DebugInt3();
     214        return ERROR_INVALID_PARAMETER;
     215    }
    207216       
    208217    if (--crit->RecursionCount)
    209218    {
    210219        DosInterlockedDecrement( &crit->LockCount );
    211         return;
     220        return NO_ERROR;
    212221    }
    213222    crit->OwningThread = 0;
     
    217226        DosPostEventSem(crit->hmtxLock);
    218227    }
    219 }
     228    return NO_ERROR;
     229}
  • trunk/src/odincrt/odin36.def

    r8201 r9331  
    1 ; $Id: odin36.def,v 1.5 2002-04-07 14:35:25 sandervl Exp $
     1; $Id: odin36.def,v 1.6 2002-10-07 16:28:13 sandervl Exp $
    22; Odin VAC++ 3.6.5 shared multithreaded runtime
    33LIBRARY ODINCRT INITINSTANCE TERMINSTANCE
     
    978978
    979979    _DosDeleteCriticalSection@4                        @1200 NONAME
    980     _DosEnterCriticalSection@4                         @1201 NONAME
     980    _DosEnterCriticalSection@8                         @1201 NONAME
    981981    _DosInitializeCriticalSection@8                    @1202 NONAME
    982982    _DosAccessCriticalSection@8                        @1203 NONAME
  • trunk/src/odincrt/odin36d.def

    r8201 r9331  
    1 ; $Id: odin36d.def,v 1.5 2002-04-07 14:35:25 sandervl Exp $
     1; $Id: odin36d.def,v 1.6 2002-10-07 16:28:14 sandervl Exp $
    22; Odin VAC++ 3.6.5 shared multithreaded runtime
    33LIBRARY ODINCRTD INITINSTANCE TERMINSTANCE
     
    986986
    987987    _DosDeleteCriticalSection@4                        @1200 NONAME
    988     _DosEnterCriticalSection@4                         @1201 NONAME
     988    _DosEnterCriticalSection@8                         @1201 NONAME
    989989    _DosInitializeCriticalSection@8                    @1202 NONAME
    990990    _DosAccessCriticalSection@8                        @1203 NONAME
  • trunk/src/odincrt/odincrt.def

    r8201 r9331  
    1 ; $Id: odincrt.def,v 1.25 2002-04-07 14:35:25 sandervl Exp $
     1; $Id: odincrt.def,v 1.26 2002-10-07 16:28:14 sandervl Exp $
    22; Odin VAC++ 3.08 shared multithreaded runtime
    33LIBRARY ODINCRT INITINSTANCE TERMINSTANCE
     
    956956
    957957    _DosDeleteCriticalSection@4                        @1200 NONAME
    958     _DosEnterCriticalSection@4                         @1201 NONAME
     958    _DosEnterCriticalSection@8                         @1201 NONAME
    959959    _DosInitializeCriticalSection@8                    @1202 NONAME
    960960    _DosAccessCriticalSection@8                        @1203 NONAME
  • trunk/src/odincrt/odincrtd.def

    r8201 r9331  
    1 ; $Id: odincrtd.def,v 1.6 2002-04-07 14:35:26 sandervl Exp $
     1; $Id: odincrtd.def,v 1.7 2002-10-07 16:28:14 sandervl Exp $
    22; Odin VAC++ 3.08 shared multithreaded runtime
    33LIBRARY ODINCRTD INITINSTANCE TERMINSTANCE
     
    958958
    959959    _DosDeleteCriticalSection@4                        @1200 NONAME
    960     _DosEnterCriticalSection@4                         @1201 NONAME
     960    _DosEnterCriticalSection@8                         @1201 NONAME
    961961    _DosInitializeCriticalSection@8                    @1202 NONAME
    962962    _DosAccessCriticalSection@8                        @1203 NONAME
  • trunk/src/odincrt/odincrtp.def

    r8201 r9331  
    1 ; $Id: odincrtp.def,v 1.3 2002-04-07 14:35:26 sandervl Exp $
     1; $Id: odincrtp.def,v 1.4 2002-10-07 16:28:15 sandervl Exp $
    22; Odin VAC++ 3.08 shared multithreaded runtime
    33LIBRARY ODINCRTP INITINSTANCE TERMINSTANCE
     
    979979
    980980    _DosDeleteCriticalSection@4                        @1200 NONAME
    981     _DosEnterCriticalSection@4                         @1201 NONAME
     981    _DosEnterCriticalSection@8                         @1201 NONAME
    982982    _DosInitializeCriticalSection@8                    @1202 NONAME
    983983    _DosAccessCriticalSection@8                        @1203 NONAME
Note: See TracChangeset for help on using the changeset viewer.