From: g0dil Date: Tue, 28 Aug 2007 07:15:27 +0000 (+0000) Subject: Scheduler: Bugfix in ClockService.test.cc: restart ClockService after test so further... X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=4ec38ecb3c79f853e9ebc92e30735e6fc62ac0c9;p=senf.git Scheduler: Bugfix in ClockService.test.cc: restart ClockService after test so further test's don't fail git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@410 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Scheduler/ClockService.cci b/Scheduler/ClockService.cci index 117e475..b0ab1ca 100644 --- a/Scheduler/ClockService.cci +++ b/Scheduler/ClockService.cci @@ -118,6 +118,13 @@ prefix_ senf::ClockService::abstime_type senf::ClockService::abstime_m(clock_typ prefix_ senf::ClockService::clock_type senf::ClockService::clock_m(abstime_type time) { + ///\fixme What happens, if base_ is changed in SIGALRM while reading it here ? + + // Idea: Have *two* base values: one is written by the SIGALRM handler, the other is only + // Written by synchronous code. If they differ, we block signals, copy over and continue. If + // they transiently differ because we are reading the SIGALRM value while it is being changed + // this does not matter: We will then still copy it over. + boost::posix_time::time_duration delta (time - base_); return clock_type( delta.ticks() ) * clock_type( 1000000000UL / boost::posix_time::time_duration::ticks_per_second() ); diff --git a/Scheduler/ClockService.test.cc b/Scheduler/ClockService.test.cc index 29379db..88c68e9 100644 --- a/Scheduler/ClockService.test.cc +++ b/Scheduler/ClockService.test.cc @@ -118,6 +118,9 @@ BOOST_AUTO_UNIT_TEST(clockService) (t1 + senf::ClockService::milliseconds(200)) (senf::ClockService::now()) ); + // We need restart the clock-service here to fix up the bad heartbeat value. That's faster + // than waiting another CheckInterval seconds for SIGALRM + senf::ClockService::restart(); } ///////////////////////////////cc.e////////////////////////////////////////