repositories
/
deb_libcec.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cec: bump version to 1.6.3. check the client version, not the server version in libce...
[deb_libcec.git]
/
src
/
lib
/
platform
/
sockets
/
socket.h
diff --git
a/src/lib/platform/sockets/socket.h
b/src/lib/platform/sockets/socket.h
index 58a3e3a751efbcad16462fc173a73917703e074f..f56d515c5e76676f95573555db07ad41523fe887 100644
(file)
--- a/
src/lib/platform/sockets/socket.h
+++ b/
src/lib/platform/sockets/socket.h
@@
-105,7
+105,7
@@
namespace PLATFORM
public:
CProtectedSocket(_Socket *socket) :
m_socket(socket),
public:
CProtectedSocket(_Socket *socket) :
m_socket(socket),
- m_
iUseCount(0
) {}
+ m_
bIsIdle(true
) {}
virtual ~CProtectedSocket(void)
{
virtual ~CProtectedSocket(void)
{
@@
-151,13
+151,13
@@
namespace PLATFORM
virtual bool IsBusy(void)
{
CLockObject lock(m_mutex);
virtual bool IsBusy(void)
{
CLockObject lock(m_mutex);
- return m_socket &&
m_iUseCount > 0
;
+ return m_socket &&
!m_bIsIdle
;
}
}
- virtual
int GetUseCount
(void)
+ virtual
bool IsIdle
(void)
{
CLockObject lock(m_mutex);
{
CLockObject lock(m_mutex);
- return m_
iUseCount
;
+ return m_
socket && m_bIsIdle
;
}
virtual ssize_t Write(void* data, size_t len)
}
virtual ssize_t Write(void* data, size_t len)
@@
-208,27
+208,21
@@
namespace PLATFORM
bool WaitReady(void)
{
CLockObject lock(m_mutex);
bool WaitReady(void)
{
CLockObject lock(m_mutex);
- if (m_iUseCount > 0)
- m_condition.Wait(m_mutex);
-
- if (m_iUseCount > 0)
- return false;
-
- ++m_iUseCount;
+ m_condition.Wait(m_mutex, m_bIsIdle);
+ m_bIsIdle = false;
return true;
}
void MarkReady(void)
{
CLockObject lock(m_mutex);
return true;
}
void MarkReady(void)
{
CLockObject lock(m_mutex);
- if (m_iUseCount > 0)
- --m_iUseCount;
+ m_bIsIdle = true;
m_condition.Signal();
}
m_condition.Signal();
}
- _Socket
*
m_socket;
- CMutex m_mutex;
- CCondition m_condition;
-
int m_iUseCount
;
+ _Socket
*
m_socket;
+ CMutex
m_mutex;
+ CCondition
<bool>
m_condition;
+
bool m_bIsIdle
;
};
};
};
};