Skip to content

Commit

Permalink
Merge pull request #5442 from vpodzime/master-lmdb_testbed_fix
Browse files Browse the repository at this point in the history
Pass the actual simulation threads to pthread_join functions
  • Loading branch information
vpodzime authored Feb 1, 2024
2 parents 0b433a7 + 68aea93 commit e862039
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions libpromises/dbm_test_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ void StopSimulation(DBLoadSimulation *simulation)
Log(LOG_LEVEL_NOTICE, "Joining simulation threads with no timeout");
if (simulation->read_th_started)
{
ret = pthread_join(simulation->read_th_started, NULL);
ret = pthread_join(simulation->read_th, NULL);
simulation->read_th_started = (ret == 0);
if (ret != 0)
{
Expand All @@ -568,7 +568,7 @@ void StopSimulation(DBLoadSimulation *simulation)
}
if (simulation->write_th_started)
{
ret = pthread_join(simulation->write_th_started, NULL);
ret = pthread_join(simulation->write_th, NULL);
simulation->write_th_started = (ret == 0);
if (ret != 0)
{
Expand All @@ -578,7 +578,7 @@ void StopSimulation(DBLoadSimulation *simulation)
}
if (simulation->iter_th_started)
{
ret = pthread_join(simulation->iter_th_started, NULL);
ret = pthread_join(simulation->iter_th, NULL);
simulation->iter_th_started = (ret == 0);
if (ret != 0)
{
Expand All @@ -592,26 +592,26 @@ void StopSimulation(DBLoadSimulation *simulation)
ts.tv_sec += 5;
if (simulation->read_th_started)
{
ret = pthread_timedjoin_np(simulation->read_th_started, NULL, &ts);
simulation->read_th_started = (ret == 0);
ret = pthread_timedjoin_np(simulation->read_th, NULL, &ts);
simulation->read_th_started = (ret != 0);
if (ret != 0)
{
Log(LOG_LEVEL_ERR, "Failed to join read simulation thread: %s", GetErrorStrFromCode(ret));
}
}
if (simulation->write_th_started)
{
ret = pthread_timedjoin_np(simulation->write_th_started, NULL, &ts);
simulation->write_th_started = (ret == 0);
ret = pthread_timedjoin_np(simulation->write_th, NULL, &ts);
simulation->write_th_started = (ret != 0);
if (ret != 0)
{
Log(LOG_LEVEL_ERR, "Failed to join write simulation thread: %s", GetErrorStrFromCode(ret));
}
}
if (simulation->iter_th_started)
{
ret = pthread_timedjoin_np(simulation->iter_th_started, NULL, &ts);
simulation->iter_th_started = (ret == 0);
ret = pthread_timedjoin_np(simulation->iter_th, NULL, &ts);
simulation->iter_th_started = (ret != 0);
if (ret != 0)
{
Log(LOG_LEVEL_ERR, "Failed to join iteration simulation thread: %s",
Expand Down

0 comments on commit e862039

Please sign in to comment.