[rtems commit] posix: Protect ualarm()

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


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Jul 22 10:01:37 2013 +0200

posix: Protect ualarm()

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

---

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

diff --git a/cpukit/posix/src/ualarm.c b/cpukit/posix/src/ualarm.c
index c893800..e94eb12 100644
--- a/cpukit/posix/src/ualarm.c
+++ b/cpukit/posix/src/ualarm.c
@@ -69,6 +69,8 @@ useconds_t ualarm(
 
   the_timer = &_POSIX_signals_Ualarm_timer;
 
+  _Thread_Disable_dispatch();
+
   state = _Watchdog_Remove( the_timer );
   if ( (state == WATCHDOG_ACTIVE) || (state == WATCHDOG_REMOVE_IT) ) {
     /*
@@ -103,5 +105,7 @@ useconds_t ualarm(
     _Watchdog_Insert_ticks( the_timer, _Timespec_To_ticks( &tp ) );
   }
 
+  _Thread_Enable_dispatch();
+
   return remaining;
 }




More information about the vc mailing list