当前位置:网站首页>B_QuRT_User_Guide(19)
B_QuRT_User_Guide(19)
2022-06-11 03:00:00 【weixin_38498942】
B_QuRT_User_Guide(19)
12 屏障
線程使用屏障在程序中的特定點同步它們的執行。
當一個屏障被初始化時,它被分配一個用戶指定的整數值。 此值指示要在屏障上同步的線程數。
當線程在屏障上等待時,它會在屏障上掛起:
- 如果等待屏障的線程總數小於屏障的分配值,則不會發生其他操作。
- 如果等待屏障的線程總數等於屏障的分配值,則喚醒當前等待屏障的所有線程,允許它們越過屏障執行。
在其等待線程被喚醒後,屏障會自動重置,並且可以在程序中再次使用,而無需重新初始化。
屏障是支持以下操作的共享對象:
- qurt_barrier_destroy()
- qurt_barrier_init()
- qurt_barrier_wait()
- Data Types
12.1 qurt_barrier_destroy()
12.1.1 功能文檔
12.1.1.1 int qurt_barrier_destroy ( qurt_barrier_t ∗ barrier )
破壞指定的屏障。
注意:屏障不再使用時必須銷毀。 不這樣做會導致 QuRT 內核中的資源泄漏。
屏障仍在使用時不得破壞。 如果發生這種情况,則 QuRT 的行為是未定義的。
相關數據類型
qurt_barrier_t
參數
| in | barrier | 指向要銷毀的屏障對象的指針。 |
返回值
未使用的整數值。
依賴關系
None.
12.2 qurt_barrier_init()
12.2.1 功能文檔
12.2.1.1 int qurt_barrier_init ( qurt_barrier_t ∗ barrier, unsigned int threads_total )
初始化屏障對象。
相關數據類型
qurt_barrier_t
參數
| out | barrier | 指向要初始化的屏障對象的指針。 |
| in | threads_total | 要在屏障上同步的線程總數。 |
返回值
未使用的整數值。
依賴關系
None.
12.3 qurt_barrier_wait()
12.3.1 功能文檔
12.3.1.1 int qurt_barrier_wait ( qurt_barrier_t ∗ barrier )
等待在屏障上。
在指定的屏障上掛起當前線程。
函數返回值指示線程是否是最後一個在屏障上同步的線程。 當線程在屏障上等待時,它會在屏障上掛起:
- 如果等待屏障的線程總數小於分配的屏障值,則不會發生其他操作。
- 如果等待屏障的線程總數等於分配的屏障值,則喚醒當前等待屏障的所有線程,允許它們越過屏障執行。
注意:在其等待線程被喚醒後,屏障會自動重置,可以在程序中再次使用,無需重新初始化。
相關數據類型
qurt_barrier_t
參數
| in | barrier | 指向要等待的屏障對象的指針。 |
返回值
QURT_BARRIER_OTHER – 當前線程從屏障喚醒。
QURT_BARRIER_SERIAL_THREAD – 當前線程是屏障的最後調用者。
依賴關系
None.
12.4 數據類型
本節介紹屏障服務的數據類型。
- 障礙在QuRT 中錶示為qurt_barrier_t 類型的對象。
12.4.1 定義文檔
12.4.1.1 #define QURT_BARRIER_SERIAL_THREAD 1
串行線程。
12.4.1.2 #define QURT_BARRIER_OTHER 0
其他。
12.4.2 數據結構文檔
12.4.2.1 union qurt_barrier_t
QuRT 屏障類型。
边栏推荐
- The new colleague asked me what "where 1=1" means???
- 基于互联网架构演进, 构建秒杀系统
- Longest increasing subsequence
- How to add two factor authentication for WordPress websites
- Flink开发环境搭建及WordCount
- AOSP ~ modify WebView default implementation
- CPT 102_LEC 15
- 你的公司会选择开发数据中台吗?
- Looking at the ups and downs of the mobile phone accessories market from the green Union's sprint for IPO
- How to handle error code 30204-44 when installing office 2016 in win10?
猜你喜欢

js 内存泄漏

Live broadcast! Feature matching of orb-slam3 series (mlpnp, word bag model, etc.).

Arduino uno connected to jq8900-16p voice broadcast module

Arduino uses nRF24L01 module for wireless communication
![[new open source project] dynamic configuration task scheduling framework gobrs async joins the dromara open source community](/img/26/2d0c4e8f7f4055e614080fe526328c.png)
[new open source project] dynamic configuration task scheduling framework gobrs async joins the dromara open source community

Niuke: two numbers that only appear once in the array

Baidu submits sitemap to prompt the solution of "index type is not handled"

CPT 102_ LEC 17

Will your company choose to develop data center?

What is ttfb
随机推荐
Young people fleeing big cities: shouldering housing prices and pressure, but not epidemics
How to add cookie pop-up window in WordPress website (without plug-in)
GraphAcademy 课程讲解:《Neo4j 图数据科学基础》
微信模版消息errcode“:40165,“errmsg“:“invalid weapp pagepath
Cmake common commands
数据库唯一索引和普通索引的区别?
Manon's advanced road - Daily anecdotes
cmake常用命令
【新晋开源项目】动态配置化任务编排框架 Gobrs-Async 加入Dromara开源社区
你的公司会选择开发数据中台吗?
近期学习和更新计划
The two request sessionids of the same user are inconsistent ----- record the problem
CPT 102_LEC 13-14
Learning Tai Chi Maker - esp8226 (II)
富络经典源码富络经典系统开发原理分享
WordPress upgrade error: briefly unavailable for scheduled maintenance [resolved]
Wechat applet
CPT 102_ LEC 20
VMware虚拟机IP,网关设置。虚拟机ping不通外网
GraphAcademy 課程講解:《Neo4j 圖數據科學基礎》