From 90900d36b7a380fee19b2171f4e49eed1eb35e8d Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Tue, 26 Sep 2017 11:02:03 +0200 Subject: ipcpd: normal: Set clock to realtime clock A pthread_cond_wait was using the pthread_cond_clock and thereby timing out constantly, consuming 100% CPU. This changes it to use the realtime clock. --- src/ipcpd/normal/dht.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ipcpd/normal/dht.c b/src/ipcpd/normal/dht.c index 4d0cdb02..b06c4480 100644 --- a/src/ipcpd/normal/dht.c +++ b/src/ipcpd/normal/dht.c @@ -2320,12 +2320,12 @@ static void * dht_handle_sdu(void * o) struct cmd * cmd; int ret = 0; - clock_gettime(PTHREAD_COND_CLOCK, &dl); + clock_gettime(CLOCK_REALTIME_COARSE, &dl); ts_add(&dl, &to, &dl); pthread_mutex_lock(&dht->mtx); - while(list_is_empty(&dht->cmds) && ret != -ETIMEDOUT) + while (list_is_empty(&dht->cmds) && ret != -ETIMEDOUT) ret = -pthread_cond_timedwait(&dht->cond, &dht->mtx, &dl); @@ -2400,7 +2400,7 @@ static void * dht_handle_sdu(void * o) "DHT enrolment refused."); break; - } + } if (msg->t_refresh != KAD_T_REFR) { log_warn("Refresh time mismatch. " -- cgit v1.2.3