From 1ef8e4a8e93a848e2a68f37e029039300f1c936b Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 27 Apr 2016 22:07:56 +0200 Subject: score: Avoid Giant lock for set time of day Update #2555. Update #2630. --- cpukit/score/src/coretodadjust.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'cpukit/score/src/coretodadjust.c') diff --git a/cpukit/score/src/coretodadjust.c b/cpukit/score/src/coretodadjust.c index 51c10ec849..5996565e5c 100644 --- a/cpukit/score/src/coretodadjust.c +++ b/cpukit/score/src/coretodadjust.c @@ -18,14 +18,14 @@ #include "config.h" #endif -#include #include void _TOD_Adjust( - const Timestamp_Control delta + const Timestamp_Control *delta ) { Timestamp_Control tod; + ISR_lock_Context lock_context; /* * Currently, RTEMS does the adjustment in one movement. @@ -35,16 +35,10 @@ void _TOD_Adjust( * adjustment. */ - /* - * This prevents context switches while we are adjusting the TOD - */ - _Thread_Disable_dispatch(); - - _TOD_Get( &tod ); - - _Timestamp_Add_to( &tod, &delta ); - - _TOD_Set( &tod ); - - _Thread_Enable_dispatch(); + _TOD_Lock(); + _TOD_Acquire( &lock_context ); + _TOD_Get( &tod ); + _Timestamp_Add_to( &tod, delta ); + _TOD_Set( &tod, &lock_context ); + _TOD_Unlock(); } -- cgit v1.2.3