repositories
/
deb_libcec.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cec: extracted a Close() method in CCECProcessor
[deb_libcec.git]
/
src
/
lib
/
CECProcessor.cpp
diff --git
a/src/lib/CECProcessor.cpp
b/src/lib/CECProcessor.cpp
index 78d24360b6da344ed7471379b9e7b96ee097c118..06f847754f621711c4f7225439ccbd4943f76f1d 100644
(file)
--- a/
src/lib/CECProcessor.cpp
+++ b/
src/lib/CECProcessor.cpp
@@
-115,15
+115,25
@@
CCECProcessor::CCECProcessor(CLibCEC *controller, const char *strDeviceName, con
CCECProcessor::~CCECProcessor(void)
{
CCECProcessor::~CCECProcessor(void)
{
-
StopThread
();
+
Close
();
- delete m_communication;
- m_communication = NULL;
- m_controller = NULL;
for (unsigned int iPtr = 0; iPtr < 16; iPtr++)
delete m_busDevices[iPtr];
}
for (unsigned int iPtr = 0; iPtr < 16; iPtr++)
delete m_busDevices[iPtr];
}
+void CCECProcessor::Close(void)
+{
+ StopThread();
+
+ CLockObject lock(m_mutex);
+ if (m_communication)
+ {
+ m_communication->Close();
+ delete m_communication;
+ m_communication = NULL;
+ }
+}
+
bool CCECProcessor::OpenConnection(const char *strPort, uint16_t iBaudRate, uint32_t iTimeoutMs)
{
bool bReturn(false);
bool CCECProcessor::OpenConnection(const char *strPort, uint16_t iBaudRate, uint32_t iTimeoutMs)
{
bool bReturn(false);
@@
-411,13
+421,6
@@
void *CCECProcessor::Process(void)
Sleep(5);
}
Sleep(5);
}
- if (m_communication)
- {
- m_communication->Close();
- delete m_communication;
- m_communication = NULL;
- }
-
return NULL;
}
return NULL;
}