mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-16 23:22:31 +00:00
Do thread cleanup within the same thread context.
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user