repositories
/
deb_libcec.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
97638c4
)
fixed - no more delay up to 2 seconds when exiting libCEC
author
Lars Op den Kamp
<lars@opdenkamp.eu>
Sun, 7 Oct 2012 15:08:42 +0000
(17:08 +0200)
committer
Lars Op den Kamp
<lars@opdenkamp.eu>
Sun, 7 Oct 2012 15:08:42 +0000
(17:08 +0200)
src/lib/CECInputBuffer.h
patch
|
blob
|
blame
|
history
src/lib/CECProcessor.cpp
patch
|
blob
|
blame
|
history
src/lib/LibCEC.cpp
patch
|
blob
|
blame
|
history
src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp
patch
|
blob
|
blame
|
history
src/lib/adapter/Pulse-Eight/USBCECAdapterMessageQueue.cpp
patch
|
blob
|
blame
|
history
src/lib/platform/util/buffer.h
patch
|
blob
|
blame
|
history
diff --git
a/src/lib/CECInputBuffer.h
b/src/lib/CECInputBuffer.h
index 019cfdd7667f5e29ead4e15398244a01fb1c3fd5..a8679b81b611d4b231edb70ae3dd88954835c05b 100644
(file)
--- a/
src/lib/CECInputBuffer.h
+++ b/
src/lib/CECInputBuffer.h
@@
-44,6
+44,13
@@
namespace CEC
CCECInputBuffer(void) : m_bHasData(false) {}
virtual ~CCECInputBuffer(void)
{
CCECInputBuffer(void) : m_bHasData(false) {}
virtual ~CCECInputBuffer(void)
{
+ Broadcast();
+ }
+
+ void Broadcast(void)
+ {
+ PLATFORM::CLockObject lock(m_mutex);
+ m_bHasData = true;
m_condition.Broadcast();
}
m_condition.Broadcast();
}
diff --git
a/src/lib/CECProcessor.cpp
b/src/lib/CECProcessor.cpp
index 54fea57f0cb4e4a7961c7677bff8e601dbdda2e9..ad41d3c5f552fc5b854f556d732c2d074c387205 100644
(file)
--- a/
src/lib/CECProcessor.cpp
+++ b/
src/lib/CECProcessor.cpp
@@
-104,6
+104,8
@@
void CCECProcessor::Close(void)
SetCECInitialised(false);
// stop the processor
SetCECInitialised(false);
// stop the processor
+ StopThread(-1);
+ m_inBuffer.Broadcast();
StopThread();
// close the connection
StopThread();
// close the connection
@@
-222,7
+224,7
@@
void *CCECProcessor::Process(void)
if (m_inBuffer.Pop(command, CEC_PROCESSOR_SIGNAL_WAIT_TIME))
ProcessCommand(command);
if (m_inBuffer.Pop(command, CEC_PROCESSOR_SIGNAL_WAIT_TIME))
ProcessCommand(command);
- if (CECInitialised())
+ if (CECInitialised()
&& !IsStopped()
)
{
// check clients for keypress timeouts
m_libcec->CheckKeypressTimeout();
{
// check clients for keypress timeouts
m_libcec->CheckKeypressTimeout();
diff --git
a/src/lib/LibCEC.cpp
b/src/lib/LibCEC.cpp
index 9ff5e146b6d06ff7c4607890b0eceb45ddf83f63..904204a2c8e97a1b7dd01f43ff34125966777382 100644
(file)
--- a/
src/lib/LibCEC.cpp
+++ b/
src/lib/LibCEC.cpp
@@
-418,7
+418,7
@@
CCECClient *CLibCEC::RegisterClient(libcec_configuration &configuration)
void CLibCEC::UnregisterClients(void)
{
void CLibCEC::UnregisterClients(void)
{
- if (m_cec)
+ if (m_cec
&& m_cec->IsRunning()
)
m_cec->UnregisterClients();
m_clients.clear();
m_cec->UnregisterClients();
m_clients.clear();
diff --git
a/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp
b/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp
index 7fa78f73638b96eff4e9ace948a258f57247affd..9c6743f0851ec8c7a241cddec6c3e6b39418979b 100644
(file)
--- a/
src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp
+++ b/
src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp
@@
-284,7
+284,8
@@
void *CUSBCECAdapterCommunication::Process(void)
}
/* TODO sleep 5 ms so other threads can get a lock */
}
/* TODO sleep 5 ms so other threads can get a lock */
- Sleep(5);
+ if (!IsStopped())
+ Sleep(5);
}
m_adapterMessageQueue->Clear();
}
m_adapterMessageQueue->Clear();
@@
-738,6
+739,7
@@
void CAdapterEepromWriteThread::Stop(void)
CLockObject lock(m_mutex);
if (m_iScheduleEepromWrite > 0)
m_com->LIB_CEC->AddLog(CEC_LOG_WARNING, "write thread stopped while a write was queued");
CLockObject lock(m_mutex);
if (m_iScheduleEepromWrite > 0)
m_com->LIB_CEC->AddLog(CEC_LOG_WARNING, "write thread stopped while a write was queued");
+ m_bWrite = true;
m_condition.Signal();
}
StopThread();
m_condition.Signal();
}
StopThread();
@@
-751,6
+753,8
@@
void *CAdapterEepromWriteThread::Process(void)
if ((m_iScheduleEepromWrite > 0 && m_iScheduleEepromWrite < GetTimeMs()) ||
m_condition.Wait(m_mutex, m_bWrite, 100))
{
if ((m_iScheduleEepromWrite > 0 && m_iScheduleEepromWrite < GetTimeMs()) ||
m_condition.Wait(m_mutex, m_bWrite, 100))
{
+ if (IsStopped())
+ break;
m_bWrite = false;
if (m_com->m_commands->WriteEEPROM())
{
m_bWrite = false;
if (m_com->m_commands->WriteEEPROM())
{
diff --git
a/src/lib/adapter/Pulse-Eight/USBCECAdapterMessageQueue.cpp
b/src/lib/adapter/Pulse-Eight/USBCECAdapterMessageQueue.cpp
index 35faeb71890b73892fb7a5c67b17b532b2a3d625..1b14f445f30e9bfc43afbef5304296d3277cb619 100644
(file)
--- a/
src/lib/adapter/Pulse-Eight/USBCECAdapterMessageQueue.cpp
+++ b/
src/lib/adapter/Pulse-Eight/USBCECAdapterMessageQueue.cpp
@@
-296,8
+296,9
@@
CCECAdapterMessageQueue::CCECAdapterMessageQueue(CUSBCECAdapterCommunication *co
CCECAdapterMessageQueue::~CCECAdapterMessageQueue(void)
{
CCECAdapterMessageQueue::~CCECAdapterMessageQueue(void)
{
+ StopThread(-1);
Clear();
Clear();
- StopThread(
0
);
+ StopThread();
delete m_incomingAdapterMessage;
}
delete m_incomingAdapterMessage;
}
diff --git
a/src/lib/platform/util/buffer.h
b/src/lib/platform/util/buffer.h
index 4b57a29c7d340e180f04f29222eaae9d140f7802..30fcac84167d6ec483b7d37e6d43fe535d1cd4f5 100644
(file)
--- a/
src/lib/platform/util/buffer.h
+++ b/
src/lib/platform/util/buffer.h
@@
-54,6
+54,7
@@
namespace PLATFORM
CLockObject lock(m_mutex);
while (!m_buffer.empty())
m_buffer.pop();
CLockObject lock(m_mutex);
while (!m_buffer.empty())
m_buffer.pop();
+ m_bHasMessages = true;
m_condition.Broadcast();
}
m_condition.Broadcast();
}
@@
-94,11
+95,11
@@
namespace PLATFORM
}
// pop the first item
}
// pop the first item
+ m_bHasMessages = !m_buffer.empty();
if (!m_buffer.empty())
{
entry = m_buffer.front();
m_buffer.pop();
if (!m_buffer.empty())
{
entry = m_buffer.front();
m_buffer.pop();
- m_bHasMessages = !m_buffer.empty();
bReturn = true;
}
return bReturn;
bReturn = true;
}
return bReturn;