当前位置:网站首页>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);边栏推荐
- Industrial computer anti-virus
- kubernetes集群之Label管理
- Selenium ide plug-in download, installation and use tutorial
- Computer connects raspberry pie remotely through putty
- 2022 - 021arts: début du deuxième semestre
- The cloud native programming challenge ended, and Alibaba cloud launched the first white paper on application liveliness technology in the field of cloud native
- Solution of running crash caused by node error
- Download address of the official website of national economic industry classification gb/t 4754-2017
- Implementation of ZABBIX agent active mode
- Electronic Association C language level 1 35, bank interest
猜你喜欢

Rhcsa the next day

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

Master-slave replication principle of MySQL database

CMS source code of multi wechat management system developed based on thinkphp6, with one click curd and other functions

tornado项目之路由装饰器

Introduction to rce in attack and defense world

BasicVSR++: Improving Video Super-Resolutionwith Enhanced Propagation and Alignment

Knowledge payment applet dream vending machine V2

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

Vulhub vulnerability recurrence 77_ zabbix
随机推荐
果果带你写链表,小学生看了都说好
Selection (021) - what is the output of the following code?
Valentine's Day is coming! Without 50W bride price, my girlfriend was forcibly dragged away...
BasicVSR++: Improving Video Super-Resolutionwith Enhanced Propagation and Alignment
Zabbix agent主动模式的实现
The important role of host reinforcement concept in medical industry
MySQL 45 lecture learning notes (x) force index
【网络数据传输】基于FPGA的百兆网/兆网千UDP数据包收发系统开发,PC到FPGA
Label management of kubernetes cluster
Implementation of ZABBIX agent active mode
Recursive Fusion and Deformable Spatiotemporal Attention for Video Compression Artifact Reduction
Two years ago, the United States was reluctant to sell chips, but now there are mountains of chips begging China for help
The IP bound to the socket is inaddr_ The meaning of any htonl (inaddr_any) (0.0.0.0 all addresses, uncertain addresses, arbitrary addresses)
MySQL error resolution - error 1261 (01000): row 1 doesn't contain data for all columns
Boast about Devops
Design of test cases
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
What is the use of cloud redis? How to use cloud redis?
uniapp小程序分包
The most effective futures trend strategy: futures reverse merchandising