当前位置:网站首页>Zephyr 学习笔记1,threads
Zephyr 学习笔记1,threads
2022-07-04 07:16:00 【mayiQX】
今天开始Zephyr学习,目标板子nrf9160。
第一章:如何创建线程(thread)。
1.K_THREAD_DEFINE() API
K_THREAD_DEFINE(name, stack_size, entry, p1, p2, p3, prio, options, delay)
Parameters:
name – Name of the thread.
stack_size – Stack size in bytes.
entry – Thread entry function.
p1 – 1st entry point parameter.
p2 – 2nd entry point parameter.
p3 – 3rd entry point parameter.
prio – Thread priority.
options – Thread options.
delay – Scheduling delay (in milliseconds), zero for no delay.
2.Thread 优先级分为协作式和抢占式
协作式0,抢占式
0.
3.创建以及使用thread
#define STACKSIZE 1024
#define THREAD0_PRIORITY 7
#define THREAD1_PRIORITY 7
void thread0(void)
{
}
void thread1(void)
{
}
/* Define and initialize the two threads */
K_THREAD_DEFINE(thread0_id, STACKSIZE, thread0, NULL, NULL, NULL,
THREAD0_PRIORITY, 0, 0);
K_THREAD_DEFINE(thread1_id, STACKSIZE, thread1, NULL, NULL, NULL,
THREAD1_PRIORITY, 0, 0);
边栏推荐
- 云Redis 有什么用? 云redis怎么用?
- [Flink] temporal semantics and watermark
- How to share the source code anti disclosure scheme
- Novel website program source code that can be automatically collected
- win10微软拼音输入法输入文字时候下方不出现中文提示
- Vulhub vulnerability recurrence 77_ zabbix
- Campus network problems
- 关于IDEA如何设置快捷键集
- BasicVSR++: Improving Video Super-Resolutionwith Enhanced Propagation and Alignment
- Download address of the official website of national economic industry classification gb/t 4754-2017
猜你喜欢
Pangu open source: multi support and promotion, the wave of chip industry
Mobile adaptation: vw/vh
Bottom problem of figure
CMS source code of multi wechat management system developed based on thinkphp6, with one click curd and other functions
Recursive Fusion and Deformable Spatiotemporal Attention for Video Compression Artifact Reduction
Crawler (III) crawling house prices in Tianjin
移动适配:vw/vh
Vulhub vulnerability recurrence 77_ zabbix
Transition technology from IPv4 to IPv6
Computer connects raspberry pie remotely through putty
随机推荐
Selection (023) - what are the three stages of event propagation?
The crackdown on Huawei prompted made in China to join forces to fight back, and another enterprise announced to invest 100 billion in R & D
Two years ago, the United States was reluctant to sell chips, but now there are mountains of chips begging China for help
Review of enterprise security incidents: how can enterprises do a good job in preventing source code leakage?
MySQL 45 lecture learning notes (VII) line lock
[GF (q) + LDPC] regular LDPC coding and decoding design and MATLAB simulation based on the GF (q) field of binary graph
[Valentine's day] - you can change your love and write down your lover's name
what the fuck! If you can't grab it, write it yourself. Use code to realize a Bing Dwen Dwen. It's so beautiful ~!
[kubernetes series] kubesphere is installed on kubernetes
The final week, I split
uniapp小程序分包
Introduction to rce in attack and defense world
【FPGA教程案例7】基于verilog的计数器设计与实现
云Redis 有什么用? 云redis怎么用?
Zhanrui tankbang | jointly build, cooperate and win-win zhanrui core ecology
Redis interview question set
Highly paid programmers & interview questions: how does redis of series 119 realize distributed locks?
The number of patent applications in China has again surpassed that of the United States and Japan, ranking first in the world for 11 consecutive years
测试用例的设计
Download address of the official website of national economic industry classification gb/t 4754-2017