Ignore:
Timestamp:
Jul 28, 2003, 1:35:32 PM (22 years ago)
Author:
sandervl
Message:

Updates

File:
1 edited

Legend:

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

    r9756 r10185  
    1 /* $Id: critsect.cpp,v 1.8 2003-02-06 10:30:02 sandervl Exp $ */
     1/* $Id: critsect.cpp,v 1.9 2003-07-28 11:30:17 sandervl Exp $ */
    22/*
    33 * Critical sections in the Win32 sense
    4  * 
     4 *
    55 * Copyright 2002 Sander van Leeuwen <sandervl@innotek.de>
    66 *
     
    1212#include <win32type.h>
    1313#include <win32api.h>
     14#include <FastInfoBlocks.h>
    1415
    1516#include <assert.h>
     
    2324#define DebugInt3()
    2425#endif
     26
    2527
    2628//******************************************************************************
     
    4244inline ULONG GetCurrentThreadId()
    4345{
     46#ifdef fibGetPid
     47    return MAKE_THREADID(fibGetPid(), fibGetTid());
     48#else
    4449    PTIB   ptib;
    4550    PPIB   ppib;
    4651    APIRET rc;
    47  
     52
    4853    rc = DosGetInfoBlocks(&ptib, &ppib);
    4954    if(rc == NO_ERROR) {
     
    5762    DebugInt3();
    5863    return 0;
     64#endif
    5965}
    6066//******************************************************************************
     
    6268inline ULONG GetCurrentProcessId()
    6369{
     70#ifdef fibGetPid
     71    return fibGetPid();
     72#else
    6473    PTIB   ptib;
    6574    PPIB   ppib;
    6675    APIRET rc;
    67  
     76
    6877    rc = DosGetInfoBlocks(&ptib, &ppib);
    6978    if(rc == NO_ERROR) {
     
    7281    DebugInt3();
    7382    return 0;
     83#endif
    7484}
    7585
     
    7787 *           DosInitializeCriticalSection
    7888 */
    79 ULONG WIN32API DosInitializeCriticalSection(CRITICAL_SECTION_OS2 *crit, 
     89ULONG WIN32API DosInitializeCriticalSection(CRITICAL_SECTION_OS2 *crit,
    8090                                            PSZ pszSemName, BOOL fShared)
    8191{
     
    131141    {
    132142#ifdef DEBUG
    133         if (crit->LockCount != -1 || crit->OwningThread || crit->RecursionCount)  /* Should not happen */
     143        if (  (crit->LockCount != -1 && crit->CreationCount == 1)
     144            || crit->OwningThread
     145            || crit->RecursionCount)  /* Should not happen */
    134146        {
    135147           DebugInt3();
     
    181193        ULONG ulnrposts;
    182194
    183         // now wait for it 
     195        // now wait for it
    184196        APIRET rc = DosWaitEventSem(crit->hmtxLock, ulTimeout);
    185197        if(rc != NO_ERROR) {
     
    206218        return ERROR_INVALID_PARAMETER;
    207219    }
    208        
     220
    209221    if (--crit->RecursionCount)
    210222    {
Note: See TracChangeset for help on using the changeset viewer.