当前位置:网站首页>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);
边栏推荐
- 2022-021ARTS:下半年開始
- Tar source code analysis Part 10
- Four sets of APIs for queues
- Highly paid programmers & interview questions: how does redis of series 119 realize distributed locks?
- How to share the source code anti disclosure scheme
- How can the old version of commonly used SQL be migrated to the new version?
- MySQL 45 lecture learning notes (12) MySQL will "shake" for a while
- 电子协会 C语言 1级 35 、银行利息
- Research on an endogenous data security interaction protocol oriented to dual platform and dual chain architecture
- Summary of MySQL common judgment functions!! Have you used it
猜你喜欢
BasicVSR++: Improving Video Super-Resolutionwith Enhanced Propagation and Alignment
Cell reports: Wei Fuwen group of the Institute of zoology, Chinese Academy of Sciences analyzes the function of seasonal changes in the intestinal flora of giant pandas
Introduction to spark core components
uniapp小程序分包
响应式移动Web测试题
Boosting the Performance of Video Compression Artifact Reduction with Reference Frame Proposals and
Experience installing VMware esxi 6.7 under VMware Workstation 16
Campus network problems
There is no Chinese prompt below when inputting text in win10 Microsoft Pinyin input method
SQL foundation 9 [grouping data]
随机推荐
kubernetes集群之Label管理
Pangu open source: multi support and promotion, the wave of chip industry
What is industrial computer encryption and how to do it
There is no Chinese prompt below when inputting text in win10 Microsoft Pinyin input method
Recursive Fusion and Deformable Spatiotemporal Attention for Video Compression Artifact Reduction
由于dms升级为了新版,我之前的sql在老版本的dms中,这种情况下,如何找回我之前的sql呢?
Status of the thread
Tar source code analysis Part 10
Redis - detailed explanation of cache avalanche, cache penetration and cache breakdown
Why does the producer / consumer mode wait () use while instead of if (clear and understandable)
Experience installing VMware esxi 6.7 under VMware Workstation 16
在已經知道錶格列勾選一個顯示一列
How notepad++ counts words
How to share the source code anti disclosure scheme
[FPGA tutorial case 7] design and implementation of counter based on Verilog
How can the old version of commonly used SQL be migrated to the new version?
CMS source code of multi wechat management system developed based on thinkphp6, with one click curd and other functions
输入年份、月份,确定天数
Valentine's Day is coming! Without 50W bride price, my girlfriend was forcibly dragged away...
Design of test cases