当前位置:网站首页>MFC multithreaded semaphore csemaphore critical area and mutually exclusive events
MFC multithreaded semaphore csemaphore critical area and mutually exclusive events
2022-06-24 07:26:00 【Little yellow man software】
CMutex, CCriticalSection For mutually exclusive access to resources .
CMutex Can be used across processes , CCriticalSection It can only be used inside the process .
establish CMutex Need more resources , It is only used inside the process CCriticalSection Get more efficiency .
CCriticalSection m_CritSection;// For critical zone Method 1
CSingleLock singleLock(&m_CritSection); //
//CMutex Mutex;// For mutexes Method 2
//CSingleLock singleLock(&Mutex); //
int StartMainLock()
{
singleLock.Lock();// Lock yourself without being called , Have been called and wait
if (singleLock.IsLocked())
{
int ret=StartMain(); // Locked Deal with content
singleLock.Unlock();// Unlock All unlocked before returning
return ret;
}
singleLock.Unlock();// Unlock
return -1;
}
// event
HANDLE m_hEvent= CreateEvent(NULL, FALSE, FALSE, NULL); // newly build
WaitForSingleObject(m_hEvent, INFINITE); // Infinite time waiting
ResetEvent(m_hEvent); Reset For no signal
SetEvent(m_hEvent); // Set with signal
CloseHandle(m_hEvent); // close CSemaphore Specifies the count of threads for the resource
边栏推荐
- 在js中正则表达式验证小时分钟,将输入的字符串转换为对应的小时和分钟
- PCL 点云按比率随机采样
- 第三方软件测试公司如何选择?2022国内软件测试机构排名
- 软件性能测试分析与调优实践之路-JMeter对RPC服务的性能压测分析与调优-手稿节选
- Leetcode probability interview shock series 11~15
- Introduction to game design and development - layered quaternion - dynamic layer
- How to select a third-party software testing company? 2022 ranking of domestic software testing institutions
- Fine! Storage knowledge is a must for network engineers!
- [wustctf2020] climb
- [从零开始学习FPGA编程-42]:视野篇 - 后摩尔时代”芯片设计的技术演进-1-现状
猜你喜欢

Software performance test analysis and tuning practice path - JMeter's performance pressure test analysis and tuning of RPC Services - manuscript excerpts
![[Proteus] Arduino uno + ds1307+lcd1602 time display](/img/96/d8c1cacc8a633c679b1a58a1eb8cb9.png)
[Proteus] Arduino uno + ds1307+lcd1602 time display

【图像特征提取】基于脉冲耦合神经网络(PCNN)实现图像特征提取含Matlab源码

基因检测,如何帮助患者对抗疾病?

两个链表的第一个公共节点_链表中环的入口(剑指offer)

Prefix and topic training

二分专题训练

JVM debugging tool -jmap

【图像融合】基于像素显着性结合小波变换实现多焦点和多光谱图像融合附matlab代码

The first common node of two linked lists_ The entry of the link in the linked list (Sword finger offer)
随机推荐
How to select a third-party software testing company? 2022 ranking of domestic software testing institutions
捏脸师: 炙手可热的元宇宙造型师
Unexpected token u in JSON at position 0
20个不容错过的ES6技巧
选择器(>,~,+,[])
[cnpm] tutorial
0 foundation a literature club low code development member management applet (6)
get_ started_ 3dsctf_ two thousand and sixteen
Implementation and usage analysis of static pod
The first common node of two linked lists_ The entry of the link in the linked list (Sword finger offer)
Accelerate large-scale data analysis based on Apache iceberg through data organization optimization
Win11分磁盘怎么分?Win11系统怎么分磁盘?
Dichotomous special training
Audio knowledge (V) -- data processing
[TS] function type
大厂不是衡量能力的唯一出路,上财学姐毕业三年的经验分享
超宽带脉冲定位方案,UWB精准定位技术,无线室内定位应用
伦敦金的资金管理比其他都重要
【图像分割】基于形态学实现视网膜血管分割附matlab代码
【图像融合】基于伪 Wigner 分布 (PWD) 实现图像融合附matlab代码