From 17c81cfa214c14b9d07d2a8cbda4b145bec9b6f9 Mon Sep 17 00:00:00 2001 From: "bernard.xiong" Date: Sat, 24 Oct 2009 23:07:12 +0000 Subject: [PATCH] change the mb/mq receive timeout to 0 if the re-calculated delta tick is a negative number. -- found by freescale@stmsky.com git-svn-id: https://rt-thread.googlecode.com/svn/trunk@128 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- src/ipc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ipc.c b/src/ipc.c index b88d466e7f..6e2974322c 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -26,6 +26,8 @@ * 2009-07-18 Bernard fix the event clear bug * 2009-09-09 Bernard remove fast event and fix ipc release bug * 2009-10-10 Bernard change semaphore and mutex value to unsigned value + * 2009-10-25 Bernard change the mb/mq receive timeout to 0 if the + * re-calculated delta tick is a negative number. */ #include @@ -1398,6 +1400,7 @@ rt_err_t rt_mb_recv (rt_mailbox_t mb, rt_uint32_t* value, rt_int32_t timeout) { tick_delta = rt_tick_get() - tick_delta; timeout -= tick_delta; + if (timeout < 0) timeout = 0; } } @@ -1843,6 +1846,7 @@ rt_err_t rt_mq_recv (rt_mq_t mq, void* buffer, rt_size_t size, rt_int32_t timeou { tick_delta = rt_tick_get() - tick_delta; timeout -= tick_delta; + if (timeout < 0) timeout = 0; } }