2024年网络安全最全OpenHarmony开发-线程安全阻塞队列,附相关架构及资料

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化资料的朋友,可以点击这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

producer.join();
consumer.join();

if (line.remains()==0) {
     cout << line.remains() << " elements remains in the queue. Synchronizing success." <<endl;
}

}


* SafeBlockQueueTracking的示例代码



#include
#include
#include
#include “…/include/safe_block_queue.h”

using namespace OHOS;
using namespace std;

constexpr int SIZE = 10;

class ProductsLine
{
public:
ProductsLine(int maxSize) : que(maxSize) {}

void Produce()
{
    for (int i = 0; i < SIZE + 1; i++) {
        que.Push(i);
        cout << "Add " << i << " to the line" << endl;
    }
}

void Consume()
{
    for (int i = 0; i < SIZE + 1; i++) {
        int out = que.Pop();
        cout << "Get " << out << " from the line" << endl;
        que.OneTaskDone();
    }
}

void Join()
{
    que.Join();
}

int UnfinishTaskNum()
{
    return que.GetUnfinishTaskNum();
}

private:
SafeBlockQueueTracking que;
};

int main()
{
ProductsLine line(SIZE);

thread producer(bind(&ProductsLine::Produce, ref(line)));
this_thread::sleep_for(chrono::milliseconds(1));

thread consumer(bind(&ProductsLine::Consume, ref(line)));
this_thread::sleep_for(chrono::milliseconds(1));

line.Join();

producer.join();
consumer.join();

if (line.UnfinishTaskNum()==0) {
     cout << line.UnfinishTaskNum() << " elements remains in the queue. Synchronizing success." <<endl;
}

}


2. 测试用例编译运行方法


* 测试用例代码参见base/test/unittest/common/utils\_safe\_block\_queue\_test.cpp 和 base/test/unittest/common/utils\_safe\_block\_queue\_tracking.cpp
* 使用开发者自测试框架,使用方法参见:[开发自测试执行框架-测试用例执行]( )
* 使用以下具体命令以运行`safe_block_queue.h`对应测试用例



run -t UT -tp utils -ts UtilsSafeBlockQueueTest

or

run -t UT -tp utils -ts UtilsSafeBlockQueueTrackingTest


**为了能让大家更好的学习鸿蒙(HarmonyOS NEXT)开发技术,这边特意整理了《鸿蒙开发学习手册》(共计890页),希望对大家有所帮助:[`https://qr21.cn/FV7h05`]( )**


### 《鸿蒙开发学习手册》:


#### **如何快速入门:[`https://qr21.cn/FV7h05`]( )**


1. 基本概念
2. 构建第一个ArkTS应用
3. ……


![](https://img-blog.csdnimg.cn/img_convert/afd6b98a09014e557566dec0fd065c41.webp?x-oss-process=image/format,png)


#### **开发基础知识:[`https://qr21.cn/FV7h05`]( )**


1. 应用基础知识
2. 配置文件
3. 应用数据管理
4. 应用安全管理
5. 应用隐私保护
6. 三方应用调用管控机制
7. 资源分类与访问
8. 学习ArkTS语言
9. ……


![](https://img-blog.csdnimg.cn/img_convert/c02d1bcf9201e3d3d8baf3b812f8e370.webp?x-oss-process=image/format,png)


#### **基于ArkTS 开发:[`https://qr21.cn/FV7h05`]( )**


1. Ability开发
2. UI开发
3. 公共事件与通知
4. 窗口管理
5. 媒体
6. 安全
7. 网络与链接
8. 电话服务
9. 数据管理
10. 后台任务(Background Task)管理
11. 设备管理
12. 设备使用信息统计
13. DFX
14. 国际化开发
15. 折叠屏系列
16. ……


![](https://img-blog.csdnimg.cn/img_convert/ac0f330dc7d6738a5b1180f68865890c.webp?x-oss-process=image/format,png)


#### 鸿蒙开发面试真题(含参考答案):[`https://qr18.cn/F781PH`]( )


![](https://img-blog.csdnimg.cn/img_convert/b2b4ab55693c8db2d124f48f0ea89c1d.webp?x-oss-process=image/format,png)


#### 鸿蒙开发面试大盘集篇(共计319页):[`https://qr18.cn/F781PH`]( )


1.项目开发必备面试题  
 2.性能优化方向  


### 给大家的福利


**零基础入门**


对于从来没有接触过网络安全的同学,我们帮你准备了详细的学习成长路线图。可以说是最科学最系统的学习路线,大家跟着这个大的方向学习准没问题。


![](https://img-blog.csdnimg.cn/img_convert/95608e9062782d28f4f04f821405d99a.png)


同时每个成长路线对应的板块都有配套的视频提供:


![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/a91b9e8100834e9291cfcf1695d8cd42.png#pic_center)


因篇幅有限,仅展示部分资料

**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**

**[需要这份系统化资料的朋友,可以点击这里获取](https://bbs.csdn.net/topics/618540462)**

**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

  • 10
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值