From b9b3498e77057f4c9275da74e9e2628200460b8c Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 17 Dec 2012 14:23:47 +0100 Subject: [PATCH] gettime: locking fix and debug check for identical sequence Signed-off-by: Jens Axboe --- gettime.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gettime.c b/gettime.c index bf35c716..0683bd15 100644 --- a/gettime.c +++ b/gettime.c @@ -388,8 +388,8 @@ static void *clock_thread_fn(void *data) 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 @@ static int clock_cmp(const void *p1, const void *p2) 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; } -- 2.25.1