[rtems commit] posix: Protect alarm()

Sebastian Huber sebh at rtems.org
Mon Jul 22 14:51:44 UTC 2013


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jul 19 17:18:42 2013 +0200

posix: Protect alarm()

Use thread dispatch disable/enable to ensure thread level mutual
exlusion.

---

 cpukit/posix/src/alarm.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/cpukit/posix/src/alarm.c b/cpukit/posix/src/alarm.c
index c671b9e..be3a334 100644
--- a/cpukit/posix/src/alarm.c
+++ b/cpukit/posix/src/alarm.c
@@ -57,6 +57,8 @@ unsigned int alarm(
 
   the_timer = &_POSIX_signals_Alarm_timer;
 
+  _Thread_Disable_dispatch();
+
   state = _Watchdog_Remove( the_timer );
   if ( (state == WATCHDOG_ACTIVE) || (state == WATCHDOG_REMOVE_IT) ) {
     /*
@@ -72,5 +74,7 @@ unsigned int alarm(
   if ( seconds )
     _Watchdog_Insert_seconds( the_timer, seconds );
 
+  _Thread_Enable_dispatch();
+
   return remaining;
 }




More information about the vc mailing list