changed code style

This commit is contained in:
john30
2015-02-21 13:18:36 +01:00
parent 0bfc63c13a
commit 41cd38ab75
20 changed files with 218 additions and 217 deletions
+2 -2
View File
@@ -82,7 +82,7 @@ TCPSocket* TCPClient::connect(const string& server, const int& port)
int TCPServer::start()
{
if (m_listening == true)
if (m_listening)
return 0;
m_lfd = socket(AF_INET, SOCK_STREAM, 0);
@@ -115,7 +115,7 @@ int TCPServer::start()
TCPSocket* TCPServer::newSocket()
{
if (m_listening == false)
if (!m_listening)
return NULL;
struct sockaddr_in address;
+5 -4
View File
@@ -32,11 +32,12 @@ void* Thread::runThread(void* arg)
Thread::~Thread()
{
if (m_started == true)
if (m_started) {
pthread_detach(m_threadid);
if (m_started == true)
}
if (m_started) {
pthread_cancel(m_threadid);
}
}
bool Thread::start(const char* name)
@@ -62,7 +63,7 @@ bool Thread::join()
{
int result = -1;
if (m_started == true) {
if (m_started) {
m_stopped = true;
result = pthread_join(m_threadid, NULL);
+1 -1
View File
@@ -53,7 +53,7 @@ public:
* Return whether this @a Thread is still running and not yet stopped.
* @return true if this @a Thread is till running and not yet stopped.
*/
virtual bool isRunning() { return m_running == true && m_stopped == false; }
virtual bool isRunning() { return m_running && !m_stopped; }
/**
* Create the native thread and set its name.
+2 -2
View File
@@ -87,7 +87,7 @@ public:
pthread_mutex_lock(&m_mutex);
T item;
if (wait == true) {
if (wait) {
while (m_queue.size() == 0)
pthread_cond_wait(&m_cond, &m_mutex);
item = m_queue.front();
@@ -157,7 +157,7 @@ public:
pthread_mutex_lock(&m_mutex);
T item;
if (wait == true) {
if (wait) {
while (m_queue.size() == 0)
pthread_cond_wait(&m_cond, &m_mutex);
item = m_queue.front();