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,13 +50,17 @@ TracePosix::~TracePosix()
|
|||||||
StopThread();
|
StopThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32 TracePosix::AddThreadId(char* traceMessage) const
|
WebRtc_Word32 TracePosix::AddThreadId(char* traceMessage) const {
|
||||||
{
|
#ifdef __linux__
|
||||||
WebRtc_UWord64 threadId = (WebRtc_UWord64)pthread_self();
|
pid_t threadId = (pid_t) syscall(SYS_gettid);
|
||||||
sprintf(traceMessage, "%10llu; ",
|
sprintf(traceMessage, "%10d; ", threadId);
|
||||||
static_cast<long long unsigned int>(threadId));
|
#else
|
||||||
// 12 bytes are written.
|
WebRtc_UWord64 threadId = (WebRtc_UWord64)pthread_self();
|
||||||
return 12;
|
sprintf(traceMessage, "%10llu; ",
|
||||||
|
static_cast<long long unsigned int>(threadId));
|
||||||
|
#endif
|
||||||
|
// 12 bytes are written.
|
||||||
|
return 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32 TracePosix::AddTime(char* traceMessage,
|
WebRtc_Word32 TracePosix::AddTime(char* traceMessage,
|
||||||
|
Loading…
Reference in New Issue
Block a user