]> granicus.if.org Git - icinga2/commitdiff
Apply workaround for timer tests with std::bind callbacks 6760/head
authorMichael Friedrich <michael.friedrich@icinga.com>
Thu, 8 Nov 2018 14:03:41 +0000 (15:03 +0100)
committerMichael Friedrich <michael.friedrich@icinga.com>
Thu, 8 Nov 2018 14:03:41 +0000 (15:03 +0100)
test/base-timer.cpp

index 48d20e381fb4c3d1ef6a674cdade23bda1d76ed9..a9500a2039aedcc4624eb7d1c1e126a0534f20bb 100644 (file)
@@ -39,16 +39,17 @@ BOOST_AUTO_TEST_CASE(interval)
        BOOST_CHECK(timer->GetInterval() == 1.5);
 }
 
-static void Callback(int *counter)
+int counter = 0;
+
+static void Callback(const Timer::Ptr&)
 {
-       (*counter)++;
+       counter++;
 }
 
 BOOST_AUTO_TEST_CASE(invoke)
 {
-       int counter;
        Timer::Ptr timer = new Timer();
-       timer->OnTimerExpired.connect(std::bind(&Callback, &counter));
+       timer->OnTimerExpired.connect(&Callback);
        timer->SetInterval(1);
 
        counter = 0;
@@ -61,9 +62,8 @@ BOOST_AUTO_TEST_CASE(invoke)
 
 BOOST_AUTO_TEST_CASE(scope)
 {
-       int counter;
        Timer::Ptr timer = new Timer();
-       timer->OnTimerExpired.connect(std::bind(&Callback, &counter));
+       timer->OnTimerExpired.connect(&Callback);
        timer->SetInterval(1);
 
        counter = 0;