当前位置:网站首页>C thread pool control semaphore
C thread pool control semaphore
2022-06-26 00:53:00 【App Hunter】
Purpose : Control the number of threads to execute some code 、 Avoid swarming into The asynchronous execution of causes the system to collapse .
Use :
1.
Semaphore Semaphore = new
Semaphore(3, 3); // Number of control threads
2.
public void StatisticsDate(object store){
Semaphore.WaitOne();// Number of thread pool control entries
// Code to execute
Semaphore.Release();// End current thread pool control
}
3. So the thread enters StatisticsDate The method will Execute one by one according to the specified quantity .
4. need Static class processing Semaphore, Convenient for global control .
5.Semaphore timeout handler
if (Semaphore.WaitOne(1000))
{
// The processing unit without timeout is milliseconds
}
else
{
// Waiting for timeout processing
}边栏推荐
- 10.2.2、Kylin_ Kylin installation, uploading and decompressing, verifying environment variables, starting and accessing
- SVN
- Drag the mouse to rotate the display around an object
- 论文中英文大小写、数字与标点的正确撰写方式
- Qt之自定义带游标的QSlider
- Openresty chapter 01 introduction and installation configuration
- 使用VS2022编译Telegram桌面端(tdesktop)
- 1-9Vmware中网络配置
- Law and self-regulation in the meta universe
- mtb13_Perform extract_blend_Super{Candidate(PrimaryAlternate)_Unique(可NULL过滤_Foreign_index_granulari
猜你喜欢

Redisson 3.17.4 发布

Atlas200dk brush machine

flink报错:No ExecutorFactory found to execute the application

Wireshark's analysis of IMAP packet capturing

. Net using access 2010 database

C IO stream (II) extension class_ Packer

制作3D浪漫炫酷相册【附源码】

Is camkiia the same as gcamp6f?

Idea kotlin version upgrade

jarvisoj_ level2_ x64
随机推荐
【TSP问题】基于Hopfield神经网络求解旅行商问题附Matlab代码
Establish a j-link GDB cross debugging environment for Px4
AD20(Altium Designer) PCB 高亮网络
Anaconda beginner's notes
SQL to retain the maximum value sorted by a field
Explain from a process perspective what happens to the browser after entering a URL?
Logstash discards log data that does not match the file name exactly
Solution to component stele in SMT chip processing
. user. PHP website installation problems caused by INI files
Megacli common command collation
WordPress
The development context of Ba Kong Yuan universe industry
flink报错:No ExecutorFactory found to execute the application
Leetcode 513. Find the value in the lower left corner of the tree
Optimized three-dimensional space positioning method and its fast implementation in C language
How to design the product roadmap?
Is camkiia the same as gcamp6f?
卡通shader
How product managers control the progress of product development
Example: use C # Net to teach you how to develop wechat official account (21) -- using wechat to pay online collection: H5 method