CCECProcessor::~CCECProcessor(void)
{
+ m_startCondition.Broadcast();
StopThread();
m_communication = NULL;
m_controller = NULL;
bool CCECProcessor::Start(void)
{
+ CLockObject lock(&m_mutex);
if (!m_communication || !m_communication->IsOpen())
{
m_controller->AddLog(CEC_LOG_ERROR, "connection is closed");
}
if (CreateThread())
+ {
+ if (!m_startCondition.Wait(&m_mutex))
+ {
+ m_controller->AddLog(CEC_LOG_ERROR, "could not create a processor thread");
+ return false;
+ }
return true;
+ }
else
m_controller->AddLog(CEC_LOG_ERROR, "could not create a processor thread");
void *CCECProcessor::Process(void)
{
- m_controller->AddLog(CEC_LOG_DEBUG, "processor thread started");
+ {
+ CLockObject lock(&m_mutex);
+ m_controller->AddLog(CEC_LOG_DEBUG, "processor thread started");
+ m_startCondition.Signal();
+ }
cec_command command;
CCECAdapterMessage msg;
CecBuffer<CCECAdapterMessagePtr> m_frameBuffer;
std::string m_strDeviceName;
CMutex m_mutex;
+ CCondition m_startCondition;
CAdapterCommunication *m_communication;
CLibCEC *m_controller;
bool m_bMonitor;