summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/BaseSynchronizationLib/InterlockedIncrementMsc.c
blob: f8b0eaa46d76efb4f635cb4ed0e712cbf3f6ac7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/** @file
  InterLockedIncrement function

  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
  SPDX-License-Identifier: BSD-2-Clause-Patent

**/

/**
  Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.
**/

long
_InterlockedIncrement (
  long  *lpAddend
  );

#pragma intrinsic(_InterlockedIncrement)

/**
  Performs an atomic increment of an 32-bit unsigned integer.

  Performs an atomic increment of the 32-bit unsigned integer specified by
  Value and returns the incremented value. The increment operation must be
  performed using MP safe mechanisms. The state of the return value is not
  guaranteed to be MP safe.

  @param  Value A pointer to the 32-bit value to increment.

  @return The incremented value.

**/
UINT32
EFIAPI
InternalSyncIncrement (
  IN      volatile UINT32  *Value
  )
{
  return _InterlockedIncrement ((long *)(Value));
}