From ad76edd1571fc447be1c5cc169a029c52bed134b Mon Sep 17 00:00:00 2001 From: nakeee Date: Fri, 20 Mar 2009 15:01:49 +0000 Subject: Fixed some log messages Fixed a crash when no game ini exists git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2690 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/Thread.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'Source/Core/Common/Src/Thread.cpp') diff --git a/Source/Core/Common/Src/Thread.cpp b/Source/Core/Common/Src/Thread.cpp index b4ddb1b5be..d601dfef3c 100644 --- a/Source/Core/Common/Src/Thread.cpp +++ b/Source/Core/Common/Src/Thread.cpp @@ -17,6 +17,7 @@ #include "Setup.h" #include "Thread.h" +#include "Log.h" // ----------------------------------------- #ifdef SETUP_TIMER_WAITING // ----------------- @@ -26,8 +27,6 @@ #endif // ------------------------ -#define THREAD_DEBUG 1 - namespace Common { #ifdef _WIN32 @@ -373,7 +372,7 @@ CriticalSection::~CriticalSection() void CriticalSection::Enter() { int ret = pthread_mutex_lock(&mutex); - if (ret) fprintf(stderr, "%s: pthread_mutex_lock(%p) failed: %s\n", + if (ret) ERROR_LOG(COMMON, "%s: pthread_mutex_lock(%p) failed: %s\n", __FUNCTION__, &mutex, strerror(ret)); } @@ -387,7 +386,7 @@ bool CriticalSection::TryEnter() void CriticalSection::Leave() { int ret = pthread_mutex_unlock(&mutex); - if (ret) fprintf(stderr, "%s: pthread_mutex_unlock(%p) failed: %s\n", + if (ret) ERROR_LOG(COMMON, "%s: pthread_mutex_unlock(%p) failed: %s\n", __FUNCTION__, &mutex, strerror(ret)); } @@ -399,12 +398,10 @@ Thread::Thread(ThreadFunc function, void* arg) pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 1024 * 1024); int ret = pthread_create(&thread_id, &attr, function, arg); - if (ret) fprintf(stderr, "%s: pthread_create(%p, %p, %p, %p) failed: %s\n", + if (ret) ERROR_LOG(COMMON, "%s: pthread_create(%p, %p, %p, %p) failed: %s\n", __FUNCTION__, &thread_id, &attr, function, arg, strerror(ret)); -#ifdef THREAD_DEBUG - fprintf(stderr, "created new thread %lu (func=%p, arg=%p)\n", thread_id, function, arg); -#endif + INFO_LOG(COMMON, "created new thread %lu (func=%p, arg=%p)\n", thread_id, function, arg); } @@ -420,9 +417,9 @@ void Thread::WaitForDeath() { void* exit_status; int ret = pthread_join(thread_id, &exit_status); - if (ret) fprintf(stderr, "error joining thread %lu: %s\n", thread_id, strerror(ret)); + if (ret) ERROR_LOG(COMMON, "error joining thread %lu: %s\n", thread_id, strerror(ret)); if (exit_status) - fprintf(stderr, "thread %lu exited with status %d\n", thread_id, *(int *)exit_status); + ERROR_LOG(COMMON, "thread %lu exited with status %d\n", thread_id, *(int *)exit_status); thread_id = 0; } } @@ -480,9 +477,7 @@ void SleepCurrentThread(int ms) void SetCurrentThreadName(const TCHAR* szThreadName) { pthread_setspecific(threadname_key, strdup(szThreadName)); -#ifdef THREAD_DEBUG - fprintf(stderr, "%s(%s)\n", __FUNCTION__, szThreadName); -#endif + INFO_LOG(COMMON, "%s(%s)\n", __FUNCTION__, szThreadName); } -- cgit v1.2.3