术语 | initializecriticalsection |
释义 | InitializeCriticalSection 语法: C++ void WINAPI InitializeCriticalSection( __out LPCRITICAL_SECTION lpCriticalSection ); InitializeCriticalSection函数 初始化一个临界区对象。 参数 lpCriticalSection [out] 一个临界区对象的指针。 返回值 这个函数没有返回值。 Windows Server 2003和Windows XP/2000操作系统:在内存不足的情况下,InitializeCriticalSection可以提出STATUS_NO_MEMORY异常。除了被淘汰,这与Windows Vista的开始。 备注 单个进程的线程可以使用一个互斥同步临界区对象。目前没有关于顺序的线程将获得临界区所有权的保证,但是,该系统将公平对待所有线程。 这个过程负责分配一个关键节对象,它可以通过声明类型的CRITICAL_SECTION的变量使用的内存。在使用一个关键部分,这一进程的某个线程必须初始化的对象。 经过一个临界区对象已被初始化,该进程的线程可以指定在加锁,TryEnterCriticalSection,或LeaveCriticalSection对象的功能,提供互相排斥的访问共享资源。对于不同进程之间的类似线程同步,使用互斥对象。 一个关键部分对象不能移动或复制。这一进程也绝不能修改该对象,但必须把它作为逻辑不透明。只能使用临界区的管理职能,关键节对象。当您使用完的关键部分,调用DeleteCriticalSection函数。 临界区对象必须删除才能重新初始化。初始化临界区已在初始化结果未定义的行为。 要求: 最低支持:client-Windows 2000专业版 最低支持server-Windows 2000服务器 HeaderWinbase.h(头文件:winuser.h) LibraryKernel32.lib DLLKernel32.dll 参见 CreateMutex 临界区对象 DeleteCriticalSection 加锁 InitializeCriticalSectionAndSpinCount LeaveCriticalSection 同步功能 TryEnterCriticalSection 如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com) 生成日期:2009年8月27日 ==英文原文==InitializeCriticalSection Function Initializes a critical section object. Syntax C++ void WINAPI InitializeCriticalSection( __out LPCRITICAL_SECTION lpCriticalSection ); Parameters lpCriticalSection [out] A pointer to the critical section object. Return Value This function does not return a value. Windows Server 2003 and Windows XP/2000: In low memory situations, InitializeCriticalSection can raise a STATUS_NO_MEMORY exception. This exception was eliminated starting with Windows Vista. Remarks The threads of a single process can use a critical section object for mutual-exclusion synchronization. There is no guarantee about the order in which threads will obtain ownership of the critical section, however, the system will be fair to all threads. The process is responsible for allocating the memory used by a critical section object, which it can do by declaring a variable of type CRITICAL_SECTION. Before using a critical section, some thread of the process must initialize the object. After a critical section object has been initialized, the threads of the process can specify the object in the EnterCriticalSection , TryEnterCriticalSection , or LeaveCriticalSection function to provide mutually exclusive access to a shared resource. For similar synchronization between the threads of different processes, use a mutex object. A critical section object cannot be moved or copied. The process must also not modify the object, but must treat it as logically opaque. Use only the critical section functions to manage critical section objects. When you have finished using the critical section, call the DeleteCriticalSection function. A critical section object must be deleted before it can be reinitialized. Initializing a critical section that has already been initialized results in undefined behavior. Requirements Minimum supported clientWindows 2000 Professional Minimum supported serverWindows 2000 Server HeaderWinbase.h (include Windows.h) LibraryKernel32.lib DLLKernel32.dll See Also CreateMutex Critical Section Objects DeleteCriticalSection EnterCriticalSection InitializeCriticalSectionAndSpinCount LeaveCriticalSection Synchronization Functions TryEnterCriticalSection Send comments about this topic to Microsoft Build date: 8/27/2009 ==原始网址==http://msdn.microsoft.com/en-us/library/ms683472(VS.85).aspx\n |
随便看 |
|
windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。