Applies to: desktop apps | Metro style apps
Increments (increases by one) the value of the specified 32-bit variable as an atomic operation.
To operate on 64-bit values, use the InterlockedIncrement64 function.
Syntax
LONG __cdecl InterlockedIncrement( __inout LONG volatile *Addend );
Parameters
- Addend [in, out]
-
A pointer to the variable to be incremented.
Return value
The function returns the resulting incremented value.
Remarks
The variable pointed to by the Addend parameter must be aligned on a 32-bit boundary; otherwise, this function will behave unpredictably on multiprocessor x86 systems and any non-x86 systems. See _aligned_malloc.
The interlocked functions provide a simple mechanism for synchronizing access to a variable that is shared by multiple threads. This function is atomic with respect to calls to other interlocked functions.
This function is implemented using a compiler intrinsic where possible. For more information, see the WinBase.h header file and _InterlockedIncrement.
This function generates a full memory barrier (or fence) to ensure that memory operations are completed in order.
Itanium-based systems: For performance-critical applications, use InterlockedIncrementAcquire or InterlockedIncrementRelease instead.
Requirements
|
Minimum supported client | Windows XP |
|---|---|
|
Minimum supported server | Windows Server 2003 |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- Interlocked Variable Access
- InterlockedIncrement64
- InterlockedIncrementAcquire
- InterlockedIncrementRelease
- Synchronization Functions
Send comments about this topic to Microsoft
Build date: 3/7/2012
Hi
I would like to know how to limit the usage of a dll file by n number of different processes.
For Example.
I have a dll file say MyApp.dll. Currently i have an application xyz.exe using it. Lets say i have another application abc.exe plans to use it. I need to get notification or i may need to increment a counter so that when more than "n" processes attempts to use this dll at the same time, i need to block it.
Each time a process access the dll i can increment a value in a file and decrement it when the application releases the dll. This is a workaround and is not at all appreciated. Can anybody give me a hint as to how to implement this for a Windows Mobile application?
Thanks in advance.
Arun.
[tfl - 25 08 09] Hi - and thanks for your post. You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn or the MSDN Newsgroups at
http://www.microsoft.com/communities/newsgroups/en-us/
. You are much more likely get a quicker response using the forums than through the Community Content. For specific help about:
Visual Studio :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.vstudio%2C
&
SQL Server :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.sqlserver%2C
&
.NET Framework :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.dotnet.framework
PowerShell :
http://groups.google.com/group/microsoft.public.windows.powershell/topics?pli=1
All Public :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public%2C
&