Move back to realtime clock
authorJens Axboe <jens.axboe@oracle.com>
Fri, 4 Dec 2009 08:56:32 +0000 (09:56 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 4 Dec 2009 08:56:32 +0000 (09:56 +0100)
On some systems MONOTONIC still causes a hang.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
gettime.c
mutex.c

index b1431f329bec2e3ef9e32439035d896e9f8545ca..c0d27e4cd568fbddaca2600764e01733d01620bc 100644 (file)
--- a/gettime.c
+++ b/gettime.c
@@ -130,7 +130,7 @@ gtod:
        } else {
                struct timespec ts;
 
        } else {
                struct timespec ts;
 
-               if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0) {
+               if (clock_gettime(CLOCK_REALTIME, &ts) < 0) {
                        clock_gettime_works = 0;
                        goto gtod;
                }
                        clock_gettime_works = 0;
                        goto gtod;
                }
diff --git a/mutex.c b/mutex.c
index 34b3324ca7d395f49e1579390ba2f60322dd2ba1..a44743745ab43d18b8342a67598b4977c1e43557 100644 (file)
--- a/mutex.c
+++ b/mutex.c
@@ -72,7 +72,6 @@ struct fio_mutex *fio_mutex_init(int value)
 
        pthread_condattr_init(&cond);
        pthread_condattr_setpshared(&cond, mflag);
 
        pthread_condattr_init(&cond);
        pthread_condattr_setpshared(&cond, mflag);
-       pthread_condattr_setclock(&cond, CLOCK_MONOTONIC);
        pthread_cond_init(&mutex->cond, &cond);
 
        ret = pthread_mutex_init(&mutex->lock, &attr);
        pthread_cond_init(&mutex->cond, &cond);
 
        ret = pthread_mutex_init(&mutex->lock, &attr);
@@ -95,7 +94,7 @@ int fio_mutex_down_timeout(struct fio_mutex *mutex, unsigned int seconds)
        struct timespec t;
        int ret = 0;
 
        struct timespec t;
        int ret = 0;
 
-       clock_gettime(CLOCK_MONOTONIC, &t);
+       clock_gettime(CLOCK_REALTIME, &t);
        t.tv_sec += seconds;
 
        pthread_mutex_lock(&mutex->lock);
        t.tv_sec += seconds;
 
        pthread_mutex_lock(&mutex->lock);