Logger: global Log mutex is now available from C code

This way the C++ logging API can still be used while allowing for C
files to use the same mutex.

Change-Id: I473e57479f8ae98a84ad00b76ff338f79f732236
diff --git a/CommonLibs/Logger.cpp b/CommonLibs/Logger.cpp
index 171c635..f68fab5 100644
--- a/CommonLibs/Logger.cpp
+++ b/CommonLibs/Logger.cpp
@@ -35,8 +35,6 @@
 
 using namespace std;
 
-Mutex gLogToLock;
-
 std::ostream& operator<<(std::ostream& os, std::ostringstream& ss)
 {
 	return os << ss.str();
@@ -45,15 +43,13 @@
 Log::~Log()
 {
 	int old_state;
-	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old_state);
 	int mlen = mStream.str().size();
 	int neednl = (mlen==0 || mStream.str()[mlen-1] != '\n');
 	const char *fmt = neednl ? "%s\n" : "%s";
-	ScopedLock lock(gLogToLock);
-	// The COUT() macro prevents messages from stomping each other but adds uninteresting thread numbers,
-	// so just use std::cout.
+
+	log_mutex_lock_canceldisable(&old_state);
 	LOGPSRC(mCategory, mPriority, filename, line, fmt, mStream.str().c_str());
-	pthread_setcancelstate(old_state, NULL);
+	log_mutex_unlock_canceldisable(old_state);
 }
 
 ostringstream& Log::get()