diff options
author | Allan Hessenflow <allanh@kallisti.com> | 2013-12-18 18:54:53 -0600 |
---|---|---|
committer | Gedare Bloom <gedare@rtems.org> | 2014-01-09 10:07:48 -0500 |
commit | 66bf2cc9095feb424eadbe1018f704d13a026e5d (patch) | |
tree | d9da98ac6d4dd6226a350e299b947912c67da413 /cpukit/libmisc/fb | |
parent | NTP: Sync time correctly when receiving broadcast updates (diff) | |
download | rtems-66bf2cc9095feb424eadbe1018f704d13a026e5d.tar.bz2 |
mw_uid: corrects uid_read_message short timeouts
Diffstat (limited to 'cpukit/libmisc/fb')
-rw-r--r-- | cpukit/libmisc/fb/mw_uid.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/cpukit/libmisc/fb/mw_uid.c b/cpukit/libmisc/fb/mw_uid.c index cb138dca75..a911e095e4 100644 --- a/cpukit/libmisc/fb/mw_uid.c +++ b/cpukit/libmisc/fb/mw_uid.c @@ -90,15 +90,24 @@ int uid_read_message( struct MW_UID_MESSAGE *m, unsigned long timeout ) { rtems_status_code status; size_t size = 0; - unsigned long micro_secs = timeout*1000; int wait = (timeout != 0); + int ticks = RTEMS_MICROSECONDS_TO_TICKS(timeout * 1000); + + if (timeout == (unsigned long) -1) { + ticks = RTEMS_NO_TIMEOUT; + } else if (timeout && ticks == 0) { + /* if timeout greater than 0 and smaller than a tick, round up to avoid + * unintentionally RTEMS_NO_TIMEOUT + */ + ticks = 1; + } status = rtems_message_queue_receive( queue_id, (void*)m, &size, wait ? RTEMS_WAIT : RTEMS_NO_WAIT, - RTEMS_MICROSECONDS_TO_TICKS(micro_secs) + ticks ); if( status == RTEMS_SUCCESSFUL ) { |