X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fadapter%2FCuBox%2FAdapterMessageQueue.h;h=d17f3444a7f6a1f7d77083e134a5e30136247e46;hb=51b611bcf0c25eb55d3097ba5122e3549d578a17;hp=79040843e310d782e97cfaddd3dcb224e45c1d6e;hpb=4d3a75622545306c7a5d24789d2239ed2560703f;p=deb_libcec.git diff --git a/src/lib/adapter/CuBox/AdapterMessageQueue.h b/src/lib/adapter/CuBox/AdapterMessageQueue.h index 7904084..d17f344 100644 --- a/src/lib/adapter/CuBox/AdapterMessageQueue.h +++ b/src/lib/adapter/CuBox/AdapterMessageQueue.h @@ -44,8 +44,8 @@ namespace CEC : m_bWaiting(true), m_retval((uint32_t)-1), m_bSucceeded(false) { m_hash = hashValue( - uint32_t(command.opcode_set ? command.opcode : CEC_OPCODE_NONE), - command.initiator, command.destination); + uint32_t(command.opcode_set ? command.opcode : CEC_OPCODE_NONE), + command.initiator, command.destination); } virtual ~CAdapterMessageQueueEntry(void) {} @@ -71,7 +71,7 @@ namespace CEC * @brief Signal waiting thread(s) when message matches this entry */ bool CheckMatch(uint32_t opcode, cec_logical_address initiator, - cec_logical_address destination, uint32_t response) + cec_logical_address destination, uint32_t response) { uint32_t hash = hashValue(opcode, initiator, destination); @@ -79,10 +79,10 @@ namespace CEC { CLockObject lock(m_mutex); - m_retval = response; + m_retval = response; m_bSucceeded = true; m_condition.Signal(); - return true; + return true; } return false; @@ -96,8 +96,8 @@ namespace CEC bool Wait(uint32_t iTimeout) { CLockObject lock(m_mutex); + bool bReturn = m_bSucceeded ? true : m_condition.Wait(m_mutex, m_bSucceeded, iTimeout); - m_bWaiting = false; return bReturn; } @@ -115,8 +115,8 @@ namespace CEC * @return Hash value for given cec_command */ static uint32_t hashValue(uint32_t opcode, - cec_logical_address initiator, - cec_logical_address destination) + cec_logical_address initiator, + cec_logical_address destination) { return 1 | ((uint32_t)initiator << 8) | ((uint32_t)destination << 16) | ((uint32_t)opcode << 16);