Skip to content

Commit a1fe7b1

Browse files
author
Han Xinrong
committed
modify the error check of rt_event_recv()
1 parent 3bb8edf commit a1fe7b1

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

bsp/nrf5x/libraries/templates/nrf52x/applications/ble_nus_app.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,13 @@ static void _stack_thread(void *parameter)
603603

604604
result = rt_event_recv(stack_event, STACK_EV_DISCON | STACK_EV_DISPATCH | STACK_EV_KEY,
605605
RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, next_timeout, &event);
606-
RT_ASSERT(result == RT_EOK);
606+
if (result == -RT_ETIMEOUT) {
607+
LOG_E("wait completed timeout");
608+
continue;
609+
}else if (result == -RT_ERROR) {
610+
LOG_E("event received error");
611+
continue;
612+
}
607613

608614
if (evt_dispatch_worker() != RT_EOK)
609615
{

components/dfs/filesystems/jffs2/src/gcthread.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,13 @@ jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c)
203203
GC_THREAD_FLAG_HAS_EXIT,
204204
RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR,
205205
RT_WAITING_FOREVER, &e);
206-
RT_ASSERT(result == RT_EOK);
206+
if (result == -RT_ETIMEOUT) {
207+
LOG_E("wait completed timeout");
208+
return;
209+
}else if (result == -RT_ERROR) {
210+
LOG_E("event received error");
211+
return;
212+
}
207213

208214
// Kill and free the resources ... this is safe due to the flag
209215
// from the thread.
@@ -230,7 +236,13 @@ jffs2_garbage_collect_thread(unsigned long data)
230236
RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR,
231237
cyg_current_time() + CYGNUM_JFFS2_GS_THREAD_TICKS,
232238
&flag);
233-
RT_ASSERT(result == RT_EOK);
239+
if (result == -RT_ETIMEOUT) {
240+
LOG_E("wait completed timeout");
241+
continue;
242+
}else if (result == -RT_ERROR) {
243+
LOG_E("event received error");
244+
continue;
245+
}
234246

235247
if (flag & GC_THREAD_FLAG_STOP)
236248
break;

0 commit comments

Comments
 (0)