网站首页  词典首页

请输入您要查询的函数:

 

术语 memorybarrier
释义 MemoryBarrier
语法:
C++
void MemoryBarrier(void);
MemoryBarrier宏
创建一个硬件内存屏障(围栏),防止重新CPU的顺序读取和写入操作。它也可能会阻止从重新编译器订货读取和写入操作。
参数
此宏没有参数。
返回值
此宏没有返回值。
备注
使用此宏或互锁功能,当记忆顺序读取和写入操作是程序操作的关键。
该_ReadBarrier,_WriteBarrier和_ReadWriteBarrier防止编译器的编译器内部对象重新排序只。使用Visual Studio 2003,波动动荡的引用命令,编译器将不会再为挥发性变量访问。与Visual Studio 2005,编译器也使用volatile变量上获取和写入volatile变量操作语义释放读操作语义(当由CPU支持)。有关更多信息,请参阅同步和多处理器的问题。
此宏可以说是所有的处理器在Windows是支持的平台,但它无权在某些平台上的影响。该定义各不相同的平台,平台。以下是这在WINNT.H宏的定义。
#ifdef _AMD64_
#define MemoryBarrier __faststorefence
#endif
#ifdef _IA64_
#define MemoryBarrier __mf
#endif
// x86
FORCEINLINE
VOID
MemoryBarrier (
VOID
)
{
LONG Barrier;
__asm {
xchg Barrier, eax
}
}
要求:
client最低支持Vista
最低支持serverWindows服务器2003
HeaderWinnt.h(头文件:winuser.h)
参见
互锁变量访问
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==MemoryBarrier Macro
Creates a hardware memory barrier (fence) that prevents the CPU from re-ordering read and write operations. It may also prevent the compiler from re-ordering read and write operations.
Syntax
C++
void MemoryBarrier(void);
Parameters
This macro has no parameters.
Return Value
This macro does not return a value.
Remarks
Use this macro or the interlocked functions when the order of memory read and write operations is critical for program operation.
The _ReadBarrier, _WriteBarrier, and _ReadWriteBarrier compiler intrinsics prevent compiler re-ordering only. With Visual Studio 2003, volatile to volatile references are ordered; the compiler will not re-order volatile variable access. With Visual Studio 2005, the compiler also uses acquire semantics for read operations on volatile variables and release semantics for write operations on volatile variables (when supported by the CPU). For more information, see Synchronization and Multiprocessor Issues .
This macro can be called on all processor platforms where Windows is supported, but it has no effect on some platforms. The definition varies from platform to platform. The following are some definitions of this macro in Winnt.h.

#ifdef _AMD64_
#define MemoryBarrier __faststorefence
#endif
#ifdef _IA64_
#define MemoryBarrier __mf
#endif
// x86
FORCEINLINE
VOID
MemoryBarrier (
VOID
)
{
LONG Barrier;
__asm {
xchg Barrier, eax
}
}
Requirements
Minimum supported clientWindows Vista
Minimum supported serverWindows Server 2003
HeaderWinnt.h (include Windows.h)
See Also
Interlocked Variable Access
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms684208(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 9:19:02