Windows Thread Synchronization With Kernel Objects
来源:互联网 发布:知柏地黄丸 编辑:程序博客网 时间:2024/05/20 06:05
The following kernel objects can be in a signaled or nonsignaled state:
Processes Threads Jobs Files Console input File change notifications
Events Waitable timers Semaphores Mutexes
The rules for a semaphore are as follows:
If the current resource count is greater than 0, the semaphore is signaled.
If the current resource count is 0, the semaphore is nonsignaled.
The system never allows the current resource count to be negative.
The current resource count can never be greater than the maximum resource count.
Mutex objects are different from all other kernel objects because they have a notion of "thread ownership."
Characteristic Mutex Critical Section
Performance Slow Fast
Can be used across process boundaries Yes No
Declaration HANDLE hmtx; CRITICAL_SECTION cs;
Initialization hmtx= CreateMutex(NULL, FALSE, NULL); InitializeCriticalSection(&cs);
Cleanup CloseHandle(hmtx); DeleteCriticalSection(&cs);
Infinite wait WaitForSingleObject(hmtx, INFINITE); EnterCriticalSection(&cs);
0 wait WaitForSingleObject(hmtx, 0); TryEnterCriticalSection(&cs);
Arbitrary wait WaitForSingleObject(hmtx, dwMilliseconds); Not possible
Release ReleaseMutex(hmtx); LeaveCriticalSection(&cs);
Can be waited on with other kernel objects Yes No
- Windows Thread Synchronization With Kernel Objects
- Windows Thread Synchronization in User Mode
- linux kernel synchronization
- Linux kernel Synchronization
- synchronization in Linux kernel
- Java Thread Synchronization
- Thread Synchronization for Beginners
- Boost.Thread.Synchronization
- Thread Synchronization for Beginners
- Thread Synchronization - UI Thread and Worker Thread
- Synchronization with other Devices
- Thread Synchronization Mechanisms in Python
- Linux thread communication and synchronization
- kernel thread
- 核心对象Kernel Objects
- Chapter 3: Kernel Objects
- Kernel Objects 内核对象
- synchronization in windows
- 3Com重开股东会讨论 华为贝恩资本购3Com现转机
- JavaScript代码(一)
- jspsmartupload组件实现单个或多个文件上传(下)
- 作一个程序员应有的素质
- 3月3日收盘行情
- Windows Thread Synchronization With Kernel Objects
- 对FckEditor编辑器在MAXTHON浏览器下选择服务器文件对话框显示不正常的改进对FckEditor编辑器在MAXTHON浏览器下选择服务器文件对话框显示不正常的改进
- Sun:收购MySQL是现代软件史第一大并购案
- 公司要来督查了!
- 李开复:我大学时对网游也很上瘾
- 条码条形码编程技术泛谈
- 利用VBScript批量复制、移动文件或文件夹
- 悄悄话终于发布了
- 北京奥运会IT攻防:没有第二次机会的战役