mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-05 17:52:29 +00:00
22 lines
336 B
C++
22 lines
336 B
C++
#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
|