Multiple Clients test

GitOrigin-RevId: 151fb5274b3ceb039e70cc67c3c948e32018bbe1
This commit is contained in:
Arseny Smirnov 2019-05-20 18:37:05 +03:00
parent 3ab3c699b7
commit 25f3626aca

View File

@ -869,4 +869,26 @@ TEST(Client, SimpleMulti) {
}
}
TEST(Client, Multi) {
std::vector<td::thread> threads;
for (int i = 0; i < 4; i++) {
threads.emplace_back([] {
for (int i = 0; i < 1000; i++) {
td::Client client;
client.send({3, td::make_tl_object<td::td_api::testSquareInt>(3)});
while (true) {
auto result = client.receive(10);
if (result.id == 3) {
break;
}
}
}
});
}
for (auto &thread : threads) {
thread.join();
}
}
} // namespace td