Re: [Dbus-cxx-users] 100% cpu usage on watcher thread under Linux
Status: Beta
Brought to you by:
rvinyard
From: Rick L. V. Jr. <rvi...@cs...> - 2009-06-12 15:54:58
|
Hello Patrick, Thanks for looking into this one. It's fixed in 0.3.1. Patrick Allison wrote: > Hi: > > watch_thread_main reuses its struct timeval timeout after passing a > pointer to it to select(). Under Linux, the timeout is modified to reflect > the amount of time remaining before timeout (i.e. zero after a timeout). > POSIX allows either behavior (modifying or not modifying), and recommends > that timeout be considered undefined after the select() call. > > Since the timeout's reduced to zero after the first call, the dispatcher's > watch thread consumes 100% of the CPU. > > A simple fix is just > struct timeval timeout = m_responsiveness; > .. select(... , &timeout); > > instead of just passing &m_responsiveness. > > Patrick > |