1414#include " roc_core/atomic.h"
1515#include " roc_core/heap_arena.h"
1616#include " roc_core/noop_arena.h"
17+ #include " roc_core/semaphore.h"
1718#include " roc_core/thread.h"
1819#include " roc_core/time.h"
1920#include " roc_pipeline/config.h"
2021#include " roc_pipeline/receiver_endpoint.h"
2122#include " roc_pipeline/receiver_session_group.h"
22- #include " roc_core/semaphore.h"
2323
2424namespace roc {
2525namespace pipeline {
@@ -88,31 +88,30 @@ TEST(state_tracker, multiple_timeout) {
8888 StateTracker state_tracker;
8989 TestThread** threads_ptr = new TestThread*[10 ];
9090
91- // set threads that last for 1 second
91+ // set threads that last for 1 second
9292 for (int i = 0 ; i < 10 ; i++) {
93- threads_ptr[i] =
94- new TestThread (state_tracker, sndio::DeviceState_Active,
95- core::timestamp (core::ClockMonotonic) + core::Millisecond * 1000 );
93+ threads_ptr[i] = new TestThread (state_tracker, sndio::DeviceState_Active,
94+ core::timestamp (core::ClockMonotonic)
95+ + core::Millisecond * 1000 );
9696 }
9797
98- // wait for start, then check if threads are running
98+ // wait for start, then check if threads are running
9999 for (int i = 0 ; i < 10 ; i++) {
100100 CHECK (threads_ptr[i]->start ());
101101 // CHECK(threads_ptr[i]->running());
102102 // roc_log(LogDebug, "check running %d\n", i);
103-
104103 }
105104 core::sleep_for (core::ClockMonotonic, core::Millisecond * 10 );
106105 for (int i = 0 ; i < 10 ; i++) {
107- // roc_log(LogDebug, "check running %d\n", i);
108- CHECK (threads_ptr[i]->running ());
106+ // roc_log(LogDebug, "check running %d\n", i);
107+ CHECK (threads_ptr[i]->running ());
109108 }
110109
111- // sleep for 2 seconds, making the threads timeout
110+ // sleep for 2 seconds, making the threads timeout
112111 roc_log (LogDebug, " started running" );
113112 core::sleep_for (core::ClockMonotonic, core::Millisecond * 2000 );
114113
115- // check if threads are stopped
114+ // check if threads are stopped
116115 for (int i = 0 ; i < 10 ; i++) {
117116 CHECK (!threads_ptr[i]->running ());
118117 }
@@ -130,7 +129,7 @@ TEST(state_tracker, multiple_switch) {
130129 StateTracker state_tracker;
131130 TestThread** threads_ptr = new TestThread*[10 ];
132131
133- // set threads without waiting time
132+ // set threads without waiting time
134133 for (int i = 0 ; i < 10 ; i++) {
135134 threads_ptr[i] = new TestThread (state_tracker, sndio::DeviceState_Active, -1 );
136135 }
@@ -141,20 +140,20 @@ TEST(state_tracker, multiple_switch) {
141140
142141 roc_log (LogDebug, " started running" );
143142
144- // wait for threads starting
143+ // wait for threads starting
145144 core::sleep_for (core::ClockMonotonic, core::Millisecond * 500 );
146145
147- // check if the threads have started
146+ // check if the threads have started
148147 for (int i = 0 ; i < 10 ; i++) {
149148 CHECK (threads_ptr[i]->running ());
150149 }
151150
152- // register a packet
151+ // register a packet
153152 core::sleep_for (core::ClockMonotonic, core::Millisecond * 500 );
154153 state_tracker.register_packet ();
155154 core::sleep_for (core::ClockMonotonic, core::Millisecond * 500 );
156155
157- // check if the threads have been stopped
156+ // check if the threads have been stopped
158157 for (int i = 0 ; i < 10 ; i++) {
159158 CHECK (!(threads_ptr[i]->running ()));
160159 }
0 commit comments