17 #include "my_config.h"
18 #include <gtest/gtest.h>
20 #include "thread_utils.h"
30 const int counter_start_value= 42;
32 class NotificationThread :
public Thread
38 : m_start_notification(start_notification),
39 m_end_notification(end_notfication),
47 EXPECT_EQ(counter_start_value, *m_counter);
49 m_start_notification->notify();
52 m_end_notification->wait_for_notification();
53 EXPECT_EQ(counter_start_value, *m_counter);
64 NotificationThread(
const NotificationThread&);
65 void operator=(
const NotificationThread&);
75 EXPECT_FALSE(notification.has_been_notified());
76 notification.notify();
77 EXPECT_TRUE(notification.has_been_notified());
84 TEST(NotificationThread, StartAndWait)
88 int counter= counter_start_value;
90 notification_thread(&start_notification, &end_notfication, &counter);
91 notification_thread.start();
94 start_notification.wait_for_notification();
95 EXPECT_EQ(counter_start_value + 1, counter);
96 EXPECT_TRUE(start_notification.has_been_notified());
99 counter= counter_start_value;
100 end_notfication.notify();
101 notification_thread.join();
104 EXPECT_EQ(counter_start_value + 1, counter);