Open yuqingli05 opened 9 months ago
欢迎提交修正的PR
欢迎提交修正的PR
我在某个项目中有大量的使用 workqueue 模块。我发现 struct rt_work 结构体会占用大量的内存,原因在于每个 struct rt_work 都包含一个定时器。我实际使用中已经 部分重构 workqueue 模块模块。不在依赖定时器。如果有必要我可以提交我的代码pr,请回复我是否有必要pr。
欢迎提交修正的PR
我在某个项目中有大量的使用 workqueue 模块。我发现 struct rt_work 结构体会占用大量的内存,原因在于每个 struct rt_work 都包含一个定时器。我实际使用中已经 部分重构 workqueue 模块模块。不在依赖定时器。如果有必要我可以提交我的代码pr,请回复我是否有必要pr。
可以先提上来看看呀
RT-Thread 版本:4.1.x,5.1.0 ,其他版本没验证 应该也存在 问题描述 rt_workqueue_submit_work 延迟任务执行,如果在定时到达之前,提前重新调用并传参tick=0,会导致定时到达之后出现bug。
问题复现代码,bsp:qemu-vexpress-a9 main.c 如下
msh输出如下:
问题分析:
_workqueue_submit_work 函数当 ticks传参等于0 的时候,没有停止上次的定时器。导致任务触发后,定时还在继续。当定时器触发之后任务已经执行完成。
解决办法: 修改 _workqueue_submit_work 函数,