From 7c5feaed3be5c26f5782e4e891ba99862f1e968f Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 22 Mar 2012 17:00:25 +0100 Subject: [PATCH] dmeventd: prevent busy looping on CPU Use usleep when looping on DM_WAIT_RETRY. --- WHATS_NEW_DM | 1 + daemons/dmeventd/dmeventd.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 1e30d2a7e..effd0cc1a 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.84 - ==================================== + Avoid busy looping on CPU when dmeventd reads event DM_WAIT_RETRY. Ensure global mutex is being hold when working with dmeventd thread. Drop taking timeout mutex for un/registering dmeventd monitor. Allow section names in config file data to be quoted strings. diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c index baa4fc3eb..179775a9a 100644 --- a/daemons/dmeventd/dmeventd.c +++ b/daemons/dmeventd/dmeventd.c @@ -796,8 +796,10 @@ static void *_monitor_thread(void *arg) thread->current_events = 0; wait_error = _event_wait(thread, &task); - if (wait_error == DM_WAIT_RETRY) + if (wait_error == DM_WAIT_RETRY) { + usleep(100); /* avoid busy loop */ continue; + } if (wait_error == DM_WAIT_FATAL) break; -- 2.43.5