当前位置:网站首页>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);边栏推荐
- Cervical vertebra, beriberi
- Status of the thread
- 响应式移动Web测试题
- Adaptive spatiotemporal fusion of multi-target networks for compressed video perception enhancement
- the input device is not a TTY. If you are using mintty, try prefixing the command with ‘winpty‘
- Responsive - media query
- Campus network problems
- 大厂技术专家:架构设计中常用的思维模型
- NLP literature reading summary
- Electronic Association C language level 1 35, bank interest
猜你喜欢

Flink memory model, network buffer, memory tuning, troubleshooting
![[thread pool]](/img/de/d19897bdcfd65026cfe2a23c41b8c0.jpg)
[thread pool]

Experience installing VMware esxi 6.7 under VMware Workstation 16

What is industrial computer encryption and how to do it

How notepad++ counts words

Valentine's Day is coming! Without 50W bride price, my girlfriend was forcibly dragged away...

The cloud native programming challenge ended, and Alibaba cloud launched the first white paper on application liveliness technology in the field of cloud native

socket inet_ pton() inet_ Ntop() function (a new network address translation function, which converts the expression format and numerical format to each other. The old ones are inet_aton(), INET_ ntoa

Industrial computer anti-virus

Master-slave replication principle of MySQL database
随机推荐
【FreeRTOS】FreeRTOS学习笔记(7)— 手写FreeRTOS双向链表/源码分析
The final week, I split
[FPGA tutorial case 7] design and implementation of counter based on Verilog
Master-slave replication principle of MySQL database
[network data transmission] FPGA based development of 100M / Gigabit UDP packet sending and receiving system, PC to FPGA
The important role of host reinforcement concept in medical industry
Responsive mobile web test questions
Valentine's Day is coming! Without 50W bride price, my girlfriend was forcibly dragged away...
Chain ide -- the infrastructure of the metauniverse
Responsive - media query
[freertos] freertos Learning notes (7) - written freertos bidirectionnel Link LIST / source analysis
MySQL 45 lecture learning notes (12) MySQL will "shake" for a while
JS common time processing functions
Unity 从Inspector界面打开资源管理器选择并记录文件路径
[FPGA tutorial case 8] design and implementation of frequency divider based on Verilog
Label management of kubernetes cluster
MySQL 45 lecture learning notes (XIII) delete half of the table data, and the table file size remains the same
Selection (023) - what are the three stages of event propagation?
Check and display one column in the known table column
MySQL 45 lecture learning notes (x) force index