[Dbus-cxx-users] 100% cpu usage on watcher thread under Linux
Status: Beta
Brought to you by:
rvinyard
From: Patrick A. <pa...@ph...> - 2009-06-11 22:11:13
|
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 |