[rtems commit] posix: Fix _POSIX_Timer_Insert_helper() locking
Sebastian Huber
sebh at rtems.org
Wed Jun 3 08:08:18 UTC 2015
Module: rtems
Branch: master
Commit: f9a2d364553aab2fa716c99de2e27ec6bbbf7d08
Changeset: http://git.rtems.org/rtems/commit/?id=f9a2d364553aab2fa716c99de2e27ec6bbbf7d08
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue Jun 2 13:57:35 2015 +0200
posix: Fix _POSIX_Timer_Insert_helper() locking
Close #2358.
---
cpukit/posix/src/timerinserthelper.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/cpukit/posix/src/timerinserthelper.c b/cpukit/posix/src/timerinserthelper.c
index 4d7c3fb..b1f3373 100644
--- a/cpukit/posix/src/timerinserthelper.c
+++ b/cpukit/posix/src/timerinserthelper.c
@@ -37,17 +37,20 @@ bool _POSIX_Timer_Insert_helper(
void *arg
)
{
- ISR_Level level;
+ ISR_lock_Context lock_context;
+ Watchdog_Header *header;
_Watchdog_Remove_ticks( timer );
- _ISR_Disable( level );
+
+ header = &_Watchdog_Ticks_header;
+ _Watchdog_Acquire( header, &lock_context );
/*
* Check to see if the watchdog has just been inserted by a
* higher priority interrupt. If so, abandon this insert.
*/
if ( timer->state != WATCHDOG_INACTIVE ) {
- _ISR_Enable( level );
+ _Watchdog_Release( header, &lock_context );
return false;
}
@@ -56,7 +59,8 @@ bool _POSIX_Timer_Insert_helper(
* so we can atomically initialize it as in use.
*/
_Watchdog_Initialize( timer, TSR, id, arg );
- _Watchdog_Insert_ticks( timer, ticks );
- _ISR_Enable( level );
+ timer->initial = ticks;
+ _Watchdog_Insert_locked( header, timer, &lock_context );
+ _Watchdog_Release( header, &lock_context );
return true;
}
More information about the vc
mailing list