Ignore:
Timestamp:
Mar 29, 2000, 7:17:18 PM (25 years ago)
Author:
sandervl
Message:

Critical section changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/critsection.cpp

    r2802 r3275  
    1 /* $Id: critsection.cpp,v 1.4 2000-02-16 14:25:36 sandervl Exp $ */
     1/* $Id: critsection.cpp,v 1.5 2000-03-29 17:17:17 sandervl Exp $ */
    22/*
    33 * Win32 critical sections
     
    8787            return;
    8888        }
     89
    8990        /* Now wait for it */
    90 
    91         if ( crit->Reserved && crit->Reserved != GetCurrentProcessId() )
     91        for (;;)
    9292        {
    93             dprintf(("Crst %p belongs to process %ld, current is %ld!\n",
    94                           crit, crit->Reserved, GetCurrentProcessId() ));
    95             return;
    96         }
    97 
    98         res = ODIN_WaitForSingleObject( crit->LockSemaphore, 5000L );
    99         if ( res == WAIT_TIMEOUT )
    100         {
    101             dprintf(("Critical section %p wait timed out, retrying (60 sec)\n", crit ));
    102             res = WaitForSingleObject( crit->LockSemaphore, 60000L );
    103         }
    104         if ( res == WAIT_TIMEOUT && TRACE_ON(relay) )
    105         {
    106             dprintf(("Critical section %p wait timed out, retrying (5 min)\n", crit ));
    107             res = WaitForSingleObject( crit->LockSemaphore, 300000L );
    108         }
    109         if (res != STATUS_WAIT_0)
    110         {
    111             dprintf(("Critical section %p wait failed err=%lx\n", crit, res ));
    112             /* FIXME: should raise an exception */
     93            res = ODIN_WaitForSingleObject( crit->LockSemaphore, 5000L );
     94            if ( res == WAIT_TIMEOUT )
     95            {
     96                dprintf(("Critical section %p wait timed out, retrying (60 sec)\n", crit ));
     97                res = ODIN_WaitForSingleObject( crit->LockSemaphore, 60000L );
     98                if ( res == WAIT_TIMEOUT && TRACE_ON(relay) )
     99                {
     100                    dprintf(("Critical section %p wait timed out, retrying (5 min)\n", crit ));
     101                    res = WaitForSingleObject( crit->LockSemaphore, 300000L );
     102                }
     103            }
     104            if (res == STATUS_WAIT_0) break;
     105
     106#if 0
     107            EXCEPTION_RECORD rec;
     108
     109            rec.ExceptionCode    = EXCEPTION_CRITICAL_SECTION_WAIT;
     110            rec.ExceptionFlags   = 0;
     111            rec.ExceptionRecord  = NULL;
     112            rec.ExceptionAddress = RaiseException;  /* sic */
     113            rec.NumberParameters = 1;
     114            rec.ExceptionInformation[0] = (DWORD)crit;
     115            RtlRaiseException( &rec );
     116#endif
     117            RaiseException(EXCEPTION_CRITICAL_SECTION_WAIT, 0, 1, (DWORD *)crit);
    113118        }
    114119    }
Note: See TracChangeset for help on using the changeset viewer.