windows-nt/Source/XPSP1/NT/net/sfm/afp/server/intrlckd.c
2020-09-26 16:20:57 +08:00

98 lines
1.5 KiB
C
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
Copyright (c) 1992 Microsoft Corporation
Module Name:
intrlckd.c
Abstract:
This module contains the routines that should have been in the EX package.
This manipulates inter-locked operations on flags and such.
Author:
Jameel Hyder (microsoft!jameelh)
Revision History:
5 Sep 1992 Initial Version
Notes: Tab stop: 4
--*/
#define FILENUM FILE_INTRLCKD
#include <afp.h>
/*** AfpInterlockedSetDword
*
* Set specified bits using the spin-lock to provide an interlocked operation.
*/
VOID FASTCALL
AfpInterlockedSetDword(
IN PDWORD pSrc,
IN DWORD Mask,
IN PAFP_SPIN_LOCK pSpinLock
)
{
KIRQL OldIrql;
ACQUIRE_SPIN_LOCK(pSpinLock, &OldIrql);
*pSrc |= Mask;
RELEASE_SPIN_LOCK(pSpinLock, OldIrql);
}
/*** AfpInterlockedClearDword
*
* Clear specified bits using the spin-lock to provide an
* interlocked operation.
*/
VOID FASTCALL
AfpInterlockedClearDword(
IN PDWORD pSrc,
IN DWORD Mask,
IN PAFP_SPIN_LOCK pSpinLock
)
{
KIRQL OldIrql;
ACQUIRE_SPIN_LOCK(pSpinLock, &OldIrql);
*pSrc &= ~Mask;
RELEASE_SPIN_LOCK(pSpinLock, OldIrql);
}
/*** AfpInterlockedSetNClearDword
*
* Set and Clear specified bits using the spin-lock to provide an
* interlocked operation.
*/
VOID FASTCALL
AfpInterlockedSetNClearDword(
IN PDWORD pSrc,
IN DWORD SetMask,
IN DWORD ClrMask,
IN PAFP_SPIN_LOCK pSpinLock
)
{
KIRQL OldIrql;
ACQUIRE_SPIN_LOCK(pSpinLock, &OldIrql);
*pSrc |= SetMask;
*pSrc &= ~ClrMask;
RELEASE_SPIN_LOCK(pSpinLock, OldIrql);
}