Changeset 558 for trunk/src


Ignore:
Timestamp:
Aug 18, 1999, 11:54:27 PM (26 years ago)
Author:
phaller
Message:

Fix: Interlocked Functions, Profile fix

Location:
trunk/src/kernel32
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/KERNEL32.CPP

    r550 r558  
    1 /* $Id: KERNEL32.CPP,v 1.15 1999-08-18 17:17:59 sandervl Exp $ */
     1/* $Id: KERNEL32.CPP,v 1.16 1999-08-18 21:54:26 phaller Exp $ */
    22
    33/*
     
    6262  return HMCloseHandle(hHandle);
    6363}
     64
     65
    6466//******************************************************************************
    6567HANDLE WIN32API GetStdHandle(DWORD fdwDevice)
     
    191193    return O32_InterlockedExchange(arg1, arg2);
    192194}
     195
     196
     197/************************************************************************
     198 *           InterlockedCompareExchange     [KERNEL32.879]
     199 *
     200 * Atomically compares Destination and Comperand, and if found equal exchanges
     201 * the value of Destination with Exchange
     202 *
     203 * RETURNS
     204 * Prior value of value pointed to by Destination
     205 */
     206PVOID WIN32API InterlockedCompareExchange(
     207       PVOID *Destination, /* Address of 32-bit value to exchange */
     208       PVOID Exchange,      /* change value, 32 bits */
     209            PVOID Comperand      /* value to compare, 32 bits */
     210) {
     211   PVOID ret;
     212   /* StopAllThreadsAndProcesses() */
     213
     214   ret=*Destination;
     215        if(*Destination==Comperand) *Destination=Exchange;
     216
     217   /* ResumeAllThreadsAndProcesses() */
     218   return ret;
     219}
     220
     221/************************************************************************
     222 *           InterlockedExchangeAdd            [KERNEL32.880]
     223 *
     224 * Atomically adds Increment to Addend and returns the previous value of
     225 * Addend
     226 *
     227 * RETURNS
     228 * Prior value of value pointed to by cwAddendTarget
     229 */
     230LONG WIN32API InterlockedExchangeAdd(
     231       PLONG Addend, /* Address of 32-bit value to exchange */
     232       LONG Increment /* Value to add */
     233) {
     234   LONG ret;
     235   /* StopAllThreadsAndProcesses() */
     236
     237   ret = *Addend;
     238   *Addend += Increment;
     239
     240   /* ResumeAllThreadsAndProcesses() */
     241   return ret;
     242}
     243
     244
    193245//******************************************************************************
    194246//******************************************************************************
  • trunk/src/kernel32/KERNEL32.DEF

    r550 r558  
    1 ; $Id: KERNEL32.DEF,v 1.22 1999-08-18 17:18:00 sandervl Exp $
     1; $Id: KERNEL32.DEF,v 1.23 1999-08-18 21:54:27 phaller Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    557557    InitializeCriticalSection  = _InitializeCriticalSection@4 @472
    558558;   InitializeCriticialSectionAndSpinCount = _InitializeCriticalSectionAndSpinCount@?? ;NT
    559 ;   InterlockedCompareExchange = _InterlockedCompareExchange@??         ;NT
     559    InterlockedCompareExchange = _InterlockedCompareExchange@12 @785        ;NT
    560560    InterlockedDecrement       = _InterlockedDecrement@4     @473
    561561    InterlockedExchange        = _InterlockedExchange@8      @474
    562 ;   InterlockedExchangeAdd     = _InterlockedExchangeAdd@??             ;NT
     562    InterlockedExchangeAdd     = _InterlockedExchangeAdd@8      @786        ;NT
    563563    InterlockedIncrement       = _InterlockedIncrement@4     @475
    564564;   InvalidateNLSCache         = _InvalidateNLSCache@??      @476       ;W95
  • trunk/src/kernel32/profile.cpp

    r551 r558  
    1 /* $Id: profile.cpp,v 1.15 1999-08-18 17:26:44 sandervl Exp $ */
     1/* $Id: profile.cpp,v 1.16 1999-08-18 21:54:27 phaller Exp $ */
    22
    33/*
     
    13991399
    14001400    EnterCriticalSection(&PROFILE_CritSect);
    1401     if (MRUProfile && CurProfile->filename)
    1402     {
     1401
     1402    if (CurProfile && CurProfile->filename)
    14031403      PROFILE_FlushFile(); //flash current
     1404
     1405    if (MRUProfile)
     1406    {
    14041407      lastCurProfile = CurProfile;
    14051408      for(x = 1;x < N_CACHED_PROFILES;x++)
Note: See TracChangeset for help on using the changeset viewer.