Create log.cpp
This commit is contained in:
parent
5f5fa5c89a
commit
84b75b1306
22
log.cpp
Normal file
22
log.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
|
||||
string _log_whichThread()
|
||||
{
|
||||
char buff[32] = { 0 };
|
||||
#ifdef _WIN32
|
||||
sprintf(buff, "%ul", GetCurrentThreadId()); // DWORD
|
||||
#else
|
||||
sprintf(buff, "%ul", pthread_self());
|
||||
#endif
|
||||
string ans("Thread ");
|
||||
ans.append(buff);
|
||||
return ans;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user