gettime: locking fix and debug check for identical sequence
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/gettime.c b/gettime.c
index bf35c71..0683bd1 100644
--- a/gettime.c
+++ b/gettime.c
@@ -388,8 +388,8 @@
return (void *) 1;
}
- pthread_mutex_unlock(&t->started);
pthread_mutex_lock(&t->lock);
+ pthread_mutex_unlock(&t->started);
c = &t->entries[0];
for (i = 0; i < CLOCK_ENTRIES; i++, c++) {
@@ -414,6 +414,9 @@
const struct clock_entry *c1 = p1;
const struct clock_entry *c2 = p2;
+ if (c1->seq == c2->seq)
+ log_err("cs: bug in atomic sequence!\n");
+
return c1->seq - c2->seq;
}