[PATCH 4/9] termios: Move wake up writer task action

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Jun 10 13:11:52 UTC 2013


---
 cpukit/libcsupport/src/termios.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c
index ab0a38d..39b4d30 100644
--- a/cpukit/libcsupport/src/termios.c
+++ b/cpukit/libcsupport/src/termios.c
@@ -1359,6 +1359,7 @@ rtems_termios_enqueue_raw_characters (void *ttyp, const char *buf, int len)
 static int
 rtems_termios_refill_transmitter (struct rtems_termios_tty *tty)
 {
+  bool wakeUpWriterTask = false;
   unsigned int newTail;
   int nToSend;
   rtems_interrupt_level level;
@@ -1402,7 +1403,7 @@ rtems_termios_refill_transmitter (struct rtems_termios_tty *tty)
       /*
        * this should never happen...
        */
-      rtems_semaphore_release (tty->rawOutBuf.Semaphore);
+      wakeUpWriterTask = true;
     }
 
     nToSend = 0;
@@ -1418,7 +1419,7 @@ rtems_termios_refill_transmitter (struct rtems_termios_tty *tty)
       /*
        * wake up any pending writer task
        */
-      rtems_semaphore_release (tty->rawOutBuf.Semaphore);
+      wakeUpWriterTask = true;
     }
 
     if (newTail == tty->rawOutBuf.Head) {
@@ -1465,6 +1466,11 @@ rtems_termios_refill_transmitter (struct rtems_termios_tty *tty)
     }
     tty->rawOutBuf.Tail = newTail; /*apm*/
   }
+
+  if (wakeUpWriterTask) {
+    rtems_semaphore_release (tty->rawOutBuf.Semaphore);
+  }
+
   return nToSend;
 }
 
-- 
1.7.7




More information about the devel mailing list