Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent deadlock on pthread_exit(). #406

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/sysbench.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ static ck_ring_buffer_t queue_ring_buffer[MAX_QUEUE_LEN] CK_CC_CACHELINE;
static ck_ring_t queue_ring CK_CC_CACHELINE;

static int report_thread_created CK_CC_CACHELINE;
static bool report_thread_canceled = false;
static int checkpoints_thread_created;
static int eventgen_thread_created;

Expand Down Expand Up @@ -962,6 +963,9 @@ static void *report_thread_proc(void *arg)

for (;;)
{
if (report_thread_canceled)
break;

sb_nanosleep(pause_ns);

report_intermediate();
Expand Down Expand Up @@ -1220,7 +1224,9 @@ static int run_test(sb_test_t *test)

if (report_thread_created)
{
if (sb_thread_cancel(report_thread) || sb_thread_join(report_thread, NULL))
report_thread_canceled = 1;

if (sb_thread_join(report_thread, NULL))
log_errno(LOG_FATAL, "Terminating the reporting thread failed.");
}

Expand Down