Do thread cleanup within the same thread context.

This commit is contained in:
rakshasa
2025-05-30 10:16:03 +02:00
committed by Jari Sundell
parent de6c48ca3f
commit 2d565d1c80
7 changed files with 119 additions and 24 deletions
+21
View File
@@ -0,0 +1,21 @@
#ifndef LIBTORRENT_TEST_UTILS_H
#define LIBTORRENT_TEST_UTILS_H
#include <functional>
#include <unistd.h>
inline bool
wait_for_true(std::function<bool ()> test_function) {
int i = 100;
do {
if (test_function())
return true;
usleep(10 * 1000);
} while (--i);
return false;
}
#endif // LIBTORRENT_TEST_UTILS_H