From b1a2e4dfb6f4530f105b080fcf6e57014e90ce0d Mon Sep 17 00:00:00 2001 From: Milan Bartos Date: Mon, 20 May 2013 14:30:07 +0200 Subject: Eliminate sleep in imjournal code with sd_journal_wait modified: plugins/imjournal/imjournal.c --- plugins/imjournal/imjournal.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'plugins/imjournal/imjournal.c') diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c index 3633ec02..07ab4460 100755 --- a/plugins/imjournal/imjournal.c +++ b/plugins/imjournal/imjournal.c @@ -164,11 +164,12 @@ readjournal() { int priority = 0; int facility = 0; - /* Get next journal message, if there is none, wait a second */ - if (sd_journal_next(j) == 0) { - sleep(1); - iRet = RS_RET_OK; - goto ret; + /* Get next journal message, if there is none, wait for next */ + while (sd_journal_next(j) == 0) { + if (sd_journal_wait(j, (uint64_t) -1) < 0) { + iRet = RS_RET_ERR; + goto ret; + } } /* Get message text */ -- cgit v1.2.3