From de193fdcff777b88d0fcf2733863993ad033b13f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 11 May 2012 16:41:55 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4185 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/src/serial.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'os/hal/src') diff --git a/os/hal/src/serial.c b/os/hal/src/serial.c index aaeb5e6ee..3f06025c6 100644 --- a/os/hal/src/serial.c +++ b/os/hal/src/serial.c @@ -65,13 +65,21 @@ static size_t reads(void *ip, uint8_t *bp, size_t n) { } static bool_t putwouldblock(void *ip) { + bool_t b; - return chOQIsFullI(&((SerialDriver *)ip)->oqueue); + chSysLock(); + b = chOQIsFullI(&((SerialDriver *)ip)->oqueue); + chSysUnlock(); + return b; } static bool_t getwouldblock(void *ip) { + bool_t b; - return chIQIsEmptyI(&((SerialDriver *)ip)->iqueue); + chSysLock(); + b = chIQIsEmptyI(&((SerialDriver *)ip)->iqueue); + chSysUnlock(); + return b; } static msg_t putt(void *ip, uint8_t b, systime_t timeout) { -- cgit v1.2.3