Skip to content

Commit df5fd57

Browse files
committed
BES1-687: high CPU usage for HdmiCEC plugin due to timed wait
Signed-off-by: apatel859 <[email protected]>
1 parent a07e914 commit df5fd57

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

HdmiCec/HdmiCec.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ static bool isDeviceActiveSource = false;
8787

8888
#define CEC_SETTING_ENABLED "cecEnabled"
8989

90-
static const timespec hundred_ms {.tv_sec = 0, .tv_nsec = int(1e8) };
9190

9291
namespace WPEFramework
9392
{
@@ -1088,7 +1087,7 @@ namespace WPEFramework
10881087
pthread_cond_signal(&(_instance->m_condSigUpdate));
10891088
}
10901089
//Wait for mutex signal here to continue the worker thread again.
1091-
while (!_instance->m_pollThreadExit && ETIMEDOUT == pthread_cond_timedwait(&(_instance->m_condSig), &(_instance->m_lock), &hundred_ms));
1090+
while (!_instance->m_pollThreadExit && ETIMEDOUT == pthread_cond_wait(&(_instance->m_condSig), &(_instance->m_lock)));
10921091

10931092
}
10941093
pthread_mutex_unlock(&(_instance->m_lock));
@@ -1106,7 +1105,7 @@ namespace WPEFramework
11061105
pthread_mutex_lock(&(_instance->m_lockUpdate));//pthread_cond_wait should be mutex protected. //pthread_cond_wait will unlock the mutex and perfoms wait for the condition.
11071106
while (!_instance->m_updateThreadExit) {
11081107
//Wait for mutex signal here to continue the worker thread again.
1109-
while (!_instance->m_updateThreadExit && ETIMEDOUT == pthread_cond_timedwait(&(_instance->m_condSigUpdate), &(_instance->m_lockUpdate), &hundred_ms));
1108+
while (!_instance->m_updateThreadExit && ETIMEDOUT == pthread_cond_wait(&(_instance->m_condSigUpdate), &(_instance->m_lockUpdate)));
11101109
if (_instance->m_updateThreadExit) break;
11111110
LOGINFO("Starting cec device update check");
11121111
for(i=0; ((i< LogicalAddress::UNREGISTERED)&&(!_instance->m_updateThreadExit)); i++ ) {

0 commit comments

Comments
 (0)