当前位置:网站首页>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);
边栏推荐
- Valentine's Day is coming! Without 50W bride price, my girlfriend was forcibly dragged away...
- 响应式移动Web测试题
- MySQL error resolution - error 1261 (01000): row 1 doesn't contain data for all columns
- Set JTAG fuc invalid to normal IO port
- Implementation of ZABBIX agent active mode
- Master-slave replication principle of MySQL database
- Highly paid programmers & interview questions: how does redis of series 119 realize distributed locks?
- Lottery system test report
- MySQL 45 lecture learning notes (VII) line lock
- 2022-021ARTS:下半年開始
猜你喜欢
《剑指Offer》第2版——力扣刷题
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
Responsive - media query
电脑通过Putty远程连接树莓派
Rhcsa day 3
Pangu open source: multi support and promotion, the wave of chip industry
Introduction to rce in attack and defense world
【森城市】GIS数据漫谈(一)
The most effective futures trend strategy: futures reverse merchandising
Flink memory model, network buffer, memory tuning, troubleshooting
随机推荐
Splicing plain text into JSON strings - easy language method
Industrial computer anti-virus
Blue Bridge Cup Quick sort (code completion)
MySQL 45 lecture learning notes (XIV) count (*)
Pangu open source: multi support and promotion, the wave of chip industry
Boosting the Performance of Video Compression Artifact Reduction with Reference Frame Proposals and
Knowledge payment applet dream vending machine V2
Introduction to deep learning Ann neural network parameter optimization problem (SGD, momentum, adagrad, rmsprop, Adam)
Data double write consistency between redis and MySQL
Solution of running crash caused by node error
Highly paid programmers & interview questions: how does redis of series 119 realize distributed locks?
[freertos] freertos Learning notes (7) - written freertos bidirectionnel Link LIST / source analysis
Redis interview question set
Research on an endogenous data security interaction protocol oriented to dual platform and dual chain architecture
MySQL 45 lecture learning notes (x) force index
Chapter 1 programming problems
Introduction to spark core components
Deep profile data leakage prevention scheme
提升复杂场景三维重建精度 | 基于PaddleSeg分割无人机遥感影像
MySQL 45 lecture learning notes (XIII) delete half of the table data, and the table file size remains the same