【C语言】一种状态超时阻塞循环查询的办法
发布时间:2024年01月07日
【C语言】一种状态超时阻塞循环查询的办法
1.方法1
static void wait_notify_async(notify_type_t notify_type)
{
static rt_tick_t exit_tick;
exit_tick = rt_time_get_msec();
lb_int32 notify_success = RT_FALSE;
static int timeout;
CHKPNT;
while (notify_success == RT_FALSE) {
switch (notify_type) {
case ADAS_EXITED:
if (algorithm_status.adas_status == 2)
notify_success = RT_TRUE;
break;
case BSD_EXITED:
if (algorithm_status.bsd_status == 2)
notify_success = RT_TRUE;
break;
case DMS_EXITED:
if (algorithm_status.bsd_status == 2)
notify_success = RT_TRUE;
break;
case RECORD_EXITED:
if (record_status == 2)
notify_success = RT_TRUE;
break;
case TAKE_PICTURE_STATUS:
if (take_picure_status > 0)
notify_success = RT_TRUE;
break;
default:
break;
}
timeout = rt_time_get_msec() - exit_tick;
if (timeout >= 10 * 1000)
break;
rt_thread_mdelay(10
文章来源:https://blog.csdn.net/I_feige/article/details/135436455
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:chenni525@qq.com进行投诉反馈,一经查实,立即删除!