Skip to content

Commit

Permalink
[tests] Minor fix of variable shadowing.
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko committed Apr 25, 2023
1 parent 30e7ccd commit be254e7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions test/test_bonding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ TEST(Bonding, SRTConnectGroup)
targets.push_back(gd);
}

std::future<void> closing_promise = std::async(std::launch::async, [](int ss) {
std::future<void> closing_promise = std::async(std::launch::async, [](int s) {
std::this_thread::sleep_for(std::chrono::seconds(2));
std::cerr << "Closing group" << std::endl;
srt_close(ss);
srt_close(s);
}, ss);

std::cout << "srt_connect_group calling " << std::endl;
Expand Down
30 changes: 15 additions & 15 deletions test/test_sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,9 @@ TEST(SyncEvent, WaitForNotifyOne)

const steady_clock::duration timeout = seconds_from(5);

auto wait_async = [](Condition* cond, Mutex* mutex, const steady_clock::duration& timeout) {
CUniqueSync cc (*mutex, *cond);
return cc.wait_for(timeout);
auto wait_async = [](Condition* cv, Mutex* m, const steady_clock::duration& tmo) {
CUniqueSync cc (*m, *cv);
return cc.wait_for(tmo);
};
auto wait_async_res = async(launch::async, wait_async, &cond, &mutex, timeout);

Expand All @@ -406,9 +406,9 @@ TEST(SyncEvent, WaitNotifyOne)
Condition cond;
cond.init();

auto wait_async = [](Condition* cond, Mutex* mutex) {
UniqueLock lock(*mutex);
return cond->wait(lock);
auto wait_async = [](Condition* cv, Mutex* m) {
UniqueLock lock(*m);
return cv->wait(lock);
};
auto wait_async_res = async(launch::async, wait_async, &cond, &mutex);

Expand All @@ -432,9 +432,9 @@ TEST(SyncEvent, WaitForTwoNotifyOne)

srt::sync::atomic<bool> resource_ready(true);

auto wait_async = [&](Condition* cond, Mutex* mutex, const steady_clock::duration& timeout, int id) {
UniqueLock lock(*mutex);
if (cond->wait_for(lock, timeout) && resource_ready)
auto wait_async = [&](Condition* cv, Mutex* m, const steady_clock::duration& tmo, int id) {
UniqueLock lock(*m);
if (cv->wait_for(lock, tmo) && resource_ready)
{
notified_clients.push_back(id);
resource_ready = false;
Expand Down Expand Up @@ -536,9 +536,9 @@ TEST(SyncEvent, WaitForTwoNotifyAll)
cond.init();
const steady_clock::duration timeout = seconds_from(3);

auto wait_async = [](Condition* cond, Mutex* mutex, const steady_clock::duration& timeout) {
UniqueLock lock(*mutex);
return cond->wait_for(lock, timeout);
auto wait_async = [](Condition* cv, Mutex* m, const steady_clock::duration& tmo) {
UniqueLock lock(*m);
return cv->wait_for(lock, tmo);
};
auto wait_async1_res = async(launch::async, wait_async, &cond, &mutex, timeout);
auto wait_async2_res = async(launch::async, wait_async, &cond, &mutex, timeout);
Expand All @@ -565,9 +565,9 @@ TEST(SyncEvent, WaitForNotifyAll)
cond.init();
const steady_clock::duration timeout = seconds_from(5);

auto wait_async = [](Condition* cond, Mutex* mutex, const steady_clock::duration& timeout) {
UniqueLock lock(*mutex);
return cond->wait_for(lock, timeout);
auto wait_async = [](Condition* cv, Mutex* m, const steady_clock::duration& tmo) {
UniqueLock lock(*m);
return cv->wait_for(lock, tmo);
};
auto wait_async_res = async(launch::async, wait_async, &cond, &mutex, timeout);

Expand Down

0 comments on commit be254e7

Please sign in to comment.