Added mutex lock to log output.

This commit is contained in:
Brad Arant 2019-10-20 09:32:11 -07:00
parent 64afc5ab9f
commit 4286a7b449
6 changed files with 9 additions and 5 deletions

View File

@ -15,6 +15,4 @@ namespace coreutils {
Log(LOG_EXCEPT) << text; Log(LOG_EXCEPT) << text;
} }
Exception::~Exception() {}
} }

View File

@ -9,7 +9,6 @@ namespace coreutils {
public: public:
Exception(std::string text, std::string file = __FILE__, int line = __LINE__, int errorNumber = -1); Exception(std::string text, std::string file = __FILE__, int line = __LINE__, int errorNumber = -1);
~Exception();
std::string className; std::string className;
std::string file; std::string file;

View File

@ -62,6 +62,8 @@ namespace coreutils {
if(output) { if(output) {
mtx.lock();
std::stringstream out; std::stringstream out;
out << seq << "." << this->str() << std::endl;; out << seq << "." << this->str() << std::endl;;
@ -73,6 +75,8 @@ namespace coreutils {
std::cout << out.str(); std::cout << out.str();
++seq; ++seq;
mtx.unlock();
} }
} }

3
Log.h
View File

@ -87,6 +87,9 @@ namespace coreutils {
static int seq; static int seq;
private:
std::mutex mtx;
}; };
} }

View File

@ -5,7 +5,7 @@ do
filename="${file%.*}" filename="${file%.*}"
list="$list $filename.o" list="$list $filename.o"
echo -n "Compiling $filename..." echo -n "Compiling $filename..."
g++ -c $file & g++ -g -c $file
if [ $? = '0' ] if [ $? = '0' ]
then then
echo "OK" echo "OK"

View File

@ -1,4 +1,4 @@
#define _GLIBCXX_USE_CXX11_ABI 0
#include <iostream> #include <iostream>
#include <vector> #include <vector>