MCPcopy Create free account
hub / github.com/OAID/Tengine / test_threads

Function test_threads

internal/tests/core/test/test_notify.cpp:198–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198void test_threads(void)
199{
200 NotifyBus bus("thread", 1024, 256);
201
202 int e0 = bus.CreateEvent("thread0");
203 int e1 = bus.CreateEvent("thread1");
204 int e2 = bus.CreateEvent("thread2");
205 int e3 = bus.CreateEvent("thread3");
206 int count = 10;
207
208 std::thread t0(echo_thread, count, &bus, e0, e1);
209 std::thread t1(echo_thread, count, &bus, e1, e2);
210 std::thread t2(echo_thread, count, &bus, e2, e3);
211 std::thread t3(echo_thread, count, &bus, e3, e0);
212
213 // using furture and promise to get the quit of threads
214
215 while(true)
216 bus.ProcessAllEvents();
217
218 t0.join();
219 t1.join();
220 t2.join();
221 t3.join();
222}
223
224int main(void)
225{

Callers 1

mainFunction · 0.85

Calls 2

CreateEventMethod · 0.80
ProcessAllEventsMethod · 0.80

Tested by

no test coverage detected