Bugfix get thread ID for linux.
Review URL: http://webrtc-codereview.appspot.com/331015 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1282 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
a4863dbdf0
commit
43761beb47
@ -15,7 +15,9 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#ifdef __linux__
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
#endif
|
||||||
#ifdef WEBRTC_ANDROID
|
#ifdef WEBRTC_ANDROID
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#else
|
#else
|
||||||
@ -48,11 +50,15 @@ TracePosix::~TracePosix()
|
|||||||
StopThread();
|
StopThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32 TracePosix::AddThreadId(char* traceMessage) const
|
WebRtc_Word32 TracePosix::AddThreadId(char* traceMessage) const {
|
||||||
{
|
#ifdef __linux__
|
||||||
|
pid_t threadId = (pid_t) syscall(SYS_gettid);
|
||||||
|
sprintf(traceMessage, "%10d; ", threadId);
|
||||||
|
#else
|
||||||
WebRtc_UWord64 threadId = (WebRtc_UWord64)pthread_self();
|
WebRtc_UWord64 threadId = (WebRtc_UWord64)pthread_self();
|
||||||
sprintf(traceMessage, "%10llu; ",
|
sprintf(traceMessage, "%10llu; ",
|
||||||
static_cast<long long unsigned int>(threadId));
|
static_cast<long long unsigned int>(threadId));
|
||||||
|
#endif
|
||||||
// 12 bytes are written.
|
// 12 bytes are written.
|
||||||
return 12;
|
return 12;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user