Skip to content
Open
Show file tree
Hide file tree
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: 6 additions & 2 deletions src/sb_barrier.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ int sb_barrier_init(sb_barrier_t *barrier, unsigned int count,
if (count == 0)
return 1;

if (pthread_mutex_init(&barrier->mutex, NULL) ||
pthread_cond_init(&barrier->cond, NULL))
if (pthread_mutex_init(&barrier->mutex, NULL))
return 1;
if (pthread_cond_init(&barrier->cond, NULL))
{
pthread_mutex_destroy(&barrier->mutex);
return 1;
}

barrier->init_count = count;
barrier->count = count;
Expand Down
3 changes: 3 additions & 0 deletions src/sb_histogram.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,10 @@ void sb_histogram_print(sb_histogram_t *h)
}

if (maxcnt == 0)
{
pthread_rwlock_unlock(&h->lock);
return;
}

printf(" value ------------- distribution ------------- count\n");

Expand Down
3 changes: 2 additions & 1 deletion src/sb_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,11 @@ option_t *set_option(const char *name, const char *value, sb_arg_type_t type)
if (value == NULL)
break;

char *saveptr;
tmpbuf = strdup(value);
tmp = tmpbuf;

for (tmp = strtok(tmp, ","); tmp != NULL; tmp = strtok(NULL, ","))
for (tmp = strtok_r(tmp, ",", &saveptr); tmp != NULL; tmp = strtok_r(NULL, ",", &saveptr))
add_value(&opt->values, tmp);

free(tmpbuf);
Expand Down
9 changes: 7 additions & 2 deletions src/sysbench.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,12 +865,17 @@ static void *eventgen_thread_proc(void *arg)

ck_ring_init(&queue_ring, MAX_QUEUE_LEN);

if (pthread_mutex_init(&queue_mutex, NULL) ||
pthread_cond_init(&queue_cond, NULL))
if (pthread_mutex_init(&queue_mutex, NULL))
{
sb_barrier_wait(&worker_barrier);
return NULL;
}
if (pthread_cond_init(&queue_cond, NULL))
{
pthread_mutex_destroy(&queue_mutex);
sb_barrier_wait(&worker_barrier);
return NULL;
}

log_text(LOG_DEBUG, "Event generating thread started");

Expand Down