regressions/ck_sequence: Use flag rather than counter value for first set.

Prevents resetting exit barrier on overflow. Otherwise, hangs occur
on higher-performing systems.
ck_pring 0.5.1
Samy Al Bahra 9 years ago
parent c06fd5739f
commit f97d3da5c3

@ -115,6 +115,7 @@ main(int argc, char *argv[])
{
pthread_t *threads;
unsigned int counter = 0;
bool first = true;
int n_threads, i;
if (argc != 3) {
@ -154,8 +155,10 @@ main(int argc, char *argv[])
global.c = global.b + global.a;
ck_sequence_write_end(&seqlock);
if (counter == 1)
if (first == true) {
ck_pr_store_uint(&barrier, n_threads);
first = false;
}
counter++;
if (ck_pr_load_uint(&barrier) == 0)

Loading…
Cancel
Save