InterlockedIncrement

[DllImport("Kernel32.dll")][return: MarshalAs(UnmanagedType.I4)]
public static extern int InterlockedIncrement(
   ref int lpAddend
);

Microsoft documentation: Link

Last updated