当前位置:网站首页>B_ QuRT_ User_ Guide(19)
B_ QuRT_ User_ Guide(19)
2022-06-11 03:00:00 【weixin_ thirty-eight million four hundred and ninety-eight thou】
B_QuRT_User_Guide(19)
12 barrier
Threads use barriers to synchronize their execution at specific points in the program .
When a barrier is initialized , It is assigned a user specified integer value . This value indicates the number of threads to synchronize on the barrier .
When a thread waits on a barrier , It will hang on the barrier :
- If the total number of threads waiting for the barrier is less than the allocated value of the barrier , No other operation will occur .
- If the total number of threads waiting for the barrier is equal to the allocated value of the barrier , Then wake up all threads currently waiting for the barrier , Allow them to cross the barrier to perform .
After its waiting thread is awakened , The barrier will reset automatically , And can be used again in the program , Without re initializing .
A barrier is a shared object that supports the following operations :
- qurt_barrier_destroy()
- qurt_barrier_init()
- qurt_barrier_wait()
- Data Types
12.1 qurt_barrier_destroy()
12.1.1 Function document
12.1.1.1 int qurt_barrier_destroy ( qurt_barrier_t ∗ barrier )
Break the designated barrier .
Be careful : The barrier must be destroyed when it is no longer in use . Failure to do so will result in QuRT A resource leak in the kernel .
Do not break the barrier while it is still in use . If this happens , be QuRT The behavior of is undefined .
Related data types
qurt_barrier_t
Parameters
| in | barrier | Pointer to the barrier object to be destroyed . |
Return value
Unused integer values .
Dependency relationship
None.
12.2 qurt_barrier_init()
12.2.1 Function document
12.2.1.1 int qurt_barrier_init ( qurt_barrier_t ∗ barrier, unsigned int threads_total )
Initialize the barrier object .
Related data types
qurt_barrier_t
Parameters
| out | barrier | Pointer to the barrier object to initialize . |
| in | threads_total | The total number of threads to synchronize on the barrier . |
Return value
Unused integer values .
Dependency relationship
None.
12.3 qurt_barrier_wait()
12.3.1 Function document
12.3.1.1 int qurt_barrier_wait ( qurt_barrier_t ∗ barrier )
Waiting on the barrier .
Suspend the current thread on the specified barrier .
The return value of the function indicates whether the thread is the last thread synchronized on the barrier . When a thread waits on a barrier , It will hang on the barrier :
- If the total number of threads waiting for the barrier is less than the allocated barrier value , No other operation will occur .
- If the total number of threads waiting for the barrier is equal to the allocated barrier value , Then wake up all threads currently waiting for the barrier , Allow them to cross the barrier to perform .
Be careful : After its waiting thread is awakened , The barrier will reset automatically , It can be used again in the program , No need to reinitialize .
Related data types
qurt_barrier_t
Parameters
| in | barrier | Pointer to the barrier object to wait for . |
Return value
QURT_BARRIER_OTHER – Current thread wakes up from barrier .
QURT_BARRIER_SERIAL_THREAD – The current thread is the last caller of the barrier .
Dependency relationship
None.
12.4 data type
This section describes the data types of barrier Services .
- Obstacles in QuRT Said to qurt_barrier_t Object of type .
12.4.1 Define documents
12.4.1.1 #define QURT_BARRIER_SERIAL_THREAD 1
Serial threads .
12.4.1.2 #define QURT_BARRIER_OTHER 0
other .
12.4.2 Data structure document
12.4.2.1 union qurt_barrier_t
QuRT Barrier type .
边栏推荐
- 逃离大城市的年轻人:扛住了房价和压力,没扛住流行病
- 第七章 常用的协议简介(1)
- TCP/IP
- WordPress upgrade error: briefly unavailable for scheduled maintenance [resolved]
- MySQL is required to sort in ascending order greater than or equal to the current time, and then in descending order less than the current time
- Cmake common commands
- Problèmes de classe d'outils JDBC
- Unity项目优化详解(持续补充ing)
- CPT 102_ LEC 16
- CPT 102_ LEC 18
猜你喜欢

Go语言之Go 快速入门篇(一):第一个 Go 程序

Helm deploy traifik ingress

Blue Bridge Cup_ Xiao Lan eats candy_ Pigeon nest principle / drawer principle

完成千万元A轮融资,小象生活能否成为折扣界的“永辉”?

Uni app - one click access to user information

Chapter VII introduction to common protocols (1)

GraphAcademy 課程講解:《Neo4j 圖數據科學基礎》

CPT 102_LEC 16

微信小程序

从绿联冲刺IPO,看手机配件市场沉浮录
随机推荐
Graphacademy course explanation: Fundamentals of neo4j graph data science
Why did those who left Beijing, Shanghai and Guangzhou with a smile cry in the end?
Win10 安装Office 2016出现错误代码30204-44怎么处理?
怎样简洁明了地说清楚产品需求?
MySQL is required to sort in ascending order greater than or equal to the current time, and then in descending order less than the current time
Construction of Flink development environment and wordcount
你的公司会选择开发数据中台吗?
求MySQL先按大于等于当前时间升序排序,再按小于当前时间降序排序
Chapter VII introduction to common protocols (1)
银行选择电子招标采购的必要性
Manon's advanced road - Daily anecdotes
Looking at the ups and downs of the mobile phone accessories market from the green Union's sprint for IPO
AOSP ~ modify default volume
同一个用户的两次请求SessionId竟然不一致-----记录问题
Cygwin reports an error child_ info_ fork::abort: XXX. dll: Loaded to different address: parent(XXX) != child(XXX)
VMware虚拟机IP,网关设置。虚拟机ping不通外网
靠贴牌飞利浦冲击上市,德尔玛的自有品牌又该如何“起跳”?
GraphAcademy 课程讲解:《Neo4j 图数据科学基础》
Cypress 88359 WL command enable hotspot
Correct posture of cocoscreator's native secondary development