fixed deadlock in logger

This commit is contained in:
BadAix 2015-08-08 10:19:44 +02:00
parent e35e724110
commit e45eb08be6
5 changed files with 8 additions and 8 deletions

View file

@ -1,4 +1,4 @@
VERSION = 0.2.92
VERSION = 0.2.93
TARGET = snapclient
SHELL = /bin/bash
@ -53,7 +53,6 @@ uninstall:
@if [[ `systemctl` =~ -\.mount ]]; then \
$(MAKE) uninstallsystemd; \
elif [[ `/sbin/init --version` =~ upstart ]]; then \
echo upstart => sysv; \
$(MAKE) uninstallsysv; \
elif [[ -f /etc/init.d/cron && ! -h /etc/init.d/cron ]]; then \
$(MAKE) uninstallsysv; \

View file

@ -55,7 +55,7 @@ int Log::sync()
else if (priority_ == kOut)
std::cout << Timestamp() << " [out] " << buffer_.c_str() << std::flush;
else if (priority_ == kErr)
std::cerr << Timestamp() << " [err] " << buffer_.c_str() << std::flush;
std::cout << Timestamp() << " [err] " << buffer_.c_str() << std::flush;
else
{
std::cout << Timestamp() << " [" << std::to_string(priority_) << "] " << buffer_.c_str() << std::flush;

View file

@ -1,4 +1,4 @@
VERSION = 0.2.92
VERSION = 0.2.93
TARGET = snapserver
SHELL = /bin/bash

View file

@ -139,7 +139,7 @@ void PipeReader::worker()
}
catch(const std::exception& e)
{
std::cerr << "Exception: " << e.what() << std::endl;
logE << "Exception: " << e.what() << std::endl;
}
}
}

View file

@ -49,6 +49,7 @@ void ServerSession::start()
void ServerSession::stop()
{
std::unique_lock<std::mutex> mlock(mutex_);
active_ = false;
try
{
@ -62,13 +63,13 @@ void ServerSession::stop()
}
if (readerThread_)
{
logO << "joining readerThread\n";
logD << "joining readerThread\n";
readerThread_->join();
delete readerThread_;
}
if (writerThread_)
{
logO << "joining writerThread\n";
logD << "joining writerThread\n";
writerThread_->join();
delete writerThread_;
}
@ -79,7 +80,7 @@ void ServerSession::stop()
readerThread_ = NULL;
writerThread_ = NULL;
socket_ = NULL;
logO << "ServerSession stopped\n";
logD << "ServerSession stopped\n";
}