Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
堆_heap_动态内存管理
(tid != RT_NULL) assertion failed at function:rt_application_init,
发布于 2025-03-19 22:41:16 浏览:76
订阅该版
```c #include
#define DBG_TAG "main" #define DBG_LVL DBG_LOG #include
static rt_bool_t flag; static int result; static rt_sem_t rt_sem; static int result1; static int result2; static struct rt_thread thread1; static struct rt_thread thread2; static char stack1[512]; static char stack2[512]; static void rt_thread1(void* parament) { LOG_E("thread1 success"); flag = 1; rt_sem_release(rt_sem); } static void rt_thread2(void* parament) { LOG_E("thread2 success"); result = rt_sem_take(rt_sem, RT_WAITING_FOREVER); if(flag && result == RT_EOK) { LOG_E("take success"); } rt_sem_delete(rt_sem); } int main(void) { rt_sem = rt_sem_create("sem", 0, RT_IPC_FLAG_PRIO); if(rt_sem == RT_NULL) { LOG_E("sem error"); return -1; } else { LOG_E("sem success"); } result1 = rt_thread_init(&thread1, "thread1", rt_thread1, RT_NULL, &stack1[0], sizeof(stack1), 24, 5); result2 = rt_thread_init(&thread2, "thread2", rt_thread2, RT_NULL, &stack2[0], sizeof(stack2), 25, 5); if(result1 == RT_EOK) { rt_thread_startup(&thread1); LOG_E("thread1 error"); return -1; } else { LOG_E("thread1 error"); return -1; } if(result2 == RT_EOK) { rt_thread_startup(&thread2); } else { LOG_E("thread2 error"); return -1; } ```
查看更多
1
个回答
默认排序
按发布时间排序
CrazyH
2025-03-20
这家伙很懒,什么也没写!
不知所谓啊
撰写答案
登录
注册新账号
关注者
0
被浏览
76
关于作者
zzzzzcx
这家伙很懒,什么也没写!
提问
5
回答
1
被采纳
0
关注TA
发私信
相关问题
1
rt_malloc 申请内存失败
2
webnet heap最大使用量。
3
调度锁会引起线程内存不足
4
RT-Thread内存和字符串相关函数与C语言自带的内存和字符串相关函数冲突问题
5
webnet 是否可以做全动态网页,使用内存池来加快速度
6
boatload跳转到app反复重启,难道你们编译器有问题?
7
怎么释放动态线程占用的内存
8
内存堆使用时产生不对齐
9
pandora开发板使用cjson,内存不足。
10
小内存管理中rt_realloc的实现问题
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
RT-Thread离线包制作
2
RT-Thread 屏蔽在线软件包的方法
3
RT-Thread OS应用开发实战线上师资培训通知
4
【ci】【github】【bsp】RT-Thread仓库的CI自动编译测试
5
免费解锁MCU超能力!4月AIoT实战培训三城巡演
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
DMA
USB
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
rt-smart
FAL
I2C_IIC
cubemx
ESP8266
WIZnet_W5500
UART
ota在线升级
PWM
BSP
flash
freemodbus
packages_软件包
潘多拉开发板_Pandora
GD32
定时器
ADC
flashDB
编译报错
socket
中断
rt_mq_消息队列_msg_queue
keil_MDK
Debug
SFUD
msh
ulog
C++_cpp
at_device
本月问答贡献
聚散无由
5
个答案
4
次被采纳
RTT_逍遥
4
个答案
2
次被采纳
踩姑娘的小蘑菇
6
个答案
1
次被采纳
a1012112796
4
个答案
1
次被采纳
YZRD
3
个答案
1
次被采纳
本月文章贡献
出出啊
1
篇文章
2
次点赞
小小李sunny
1
篇文章
1
次点赞
张世争
1
篇文章
7
次点赞
crystal266
2
篇文章
1
次点赞
whj467467222
2
篇文章
1
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部