网站首页  词典首页

请输入您要查询的函数:

 

术语 heaplock
释义 HeapLock
语法:
C++
BOOL WINAPI HeapLock(
__in HANDLE hHeap
);
HeapLock功能
试图获得该临界区对象,或锁定,这是与指定的堆关联。
参数
hHeap [in]
一个句柄,堆被锁定。这是处理无论是HeapCreate或GetProcessHeap函数返回。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
如果函数成功,调用线程拥有堆锁。只有调用线程可以分配或释放的堆内存。任何调用进程的其他线程的执行将被封锁,如果该线程试图从分配或释放的堆内存。这种线程将保持到线程拥有堆锁阻塞调用HeapUnlock功能。
该HeapLock功能主要是防止有用的分配和释放堆内存,而其他线程调用线程使用HeapWalk功能。
如果HeapLock功能上与HEAP_NO_SERIALIZATION旗创建了一个名为堆,结果是不确定的。
每个成功调用HeapLock必须有相应的相应调用HeapUnlock。不调用HeapUnlock将阻止调用进程的任何其他线程执行的尝试访问堆。
实例
他列举了堆
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
堆函数
HeapUnlock
HeapWalk
内存管理功能
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==HeapLock Function
Attempts to acquire the critical section object, or lock, that is associated with a specified heap.
Syntax
C++
BOOL WINAPI HeapLock(
__in HANDLE hHeap
);
Parameters
hHeap [in]
A handle to the heap to be locked. This handle is returned by either the HeapCreate or GetProcessHeap function.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
Remarks
If the function succeeds, the calling thread owns the heap lock. Only the calling thread will be able to allocate or release memory from the heap. The execution of any other thread of the calling process will be blocked if that thread attempts to allocate or release memory from the heap. Such threads will remain blocked until the thread that owns the heap lock calls the HeapUnlock function.
The HeapLock function is primarily useful for preventing the allocation and release of heap memory by other threads while the calling thread uses the HeapWalk function.
If the HeapLock function is called on a heap created with the HEAP_NO_SERIALIZATION flag, the results are undefined.
Each successful call to HeapLock must be matched by a corresponding call to HeapUnlock. Failure to call HeapUnlock will block the execution of any other threads of the calling process that attempt to access the heap.
Examples
Enumerating a Heap
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
Heap Functions
HeapUnlock
HeapWalk
Memory Management Functions
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa366702(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 13:15:48