[rtems commit] termios: Move wake up writer task action

Sebastian Huber sebh at rtems.org
Wed Jun 12 14:08:10 UTC 2013


Module:    rtems
Branch:    master
Commit:    58cde54dcb198598edbb2559a361584d7a5b02e7
Changeset: http://git.rtems.org/rtems/commit/?id=58cde54dcb198598edbb2559a361584d7a5b02e7

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Jun 10 14:18:57 2013 +0200

termios: Move wake up writer task action

---

 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 20243ca..c5024d2 100644
--- a/cpukit/libcsupport/src/termios.c
+++ b/cpukit/libcsupport/src/termios.c
@@ -1287,6 +1287,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;
@@ -1330,7 +1331,7 @@ rtems_termios_refill_transmitter (struct rtems_termios_tty *tty)
       /*
        * this should never happen...
        */
-      rtems_semaphore_release (tty->rawOutBuf.Semaphore);
+      wakeUpWriterTask = true;
     }
 
     nToSend = 0;
@@ -1346,7 +1347,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) {
@@ -1393,6 +1394,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;
 }
 




More information about the vc mailing list