// Threads
int GetPid();
-int GetTid();
+uptr GetTid();
uptr GetThreadSelf();
void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,
uptr *stack_bottom);
}
// ----------------- sanitizer_common.h
+uptr GetTid() {
+ return syscall(__NR_gettid);
+}
+
void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,
uptr *stack_bottom) {
static const uptr kMaxThreadStackSize = 256 * (1 << 20); // 256M
}
// ----------------- sanitizer_common.h
+uptr GetTid() {
+ return reinterpret_cast<uptr>(pthread_self());
+}
+
void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,
uptr *stack_bottom) {
CHECK(stack_top);
#include <sys/resource.h>
#include <sys/time.h>
#include <sys/types.h>
-#include <syscall.h>
#include <unistd.h>
namespace __sanitizer {
return getpid();
}
-int GetTid() {
- return syscall(__NR_gettid);
-}
-
uptr GetThreadSelf() {
return (uptr)pthread_self();
}
TsanPrintf(" Thread %d", rt->id);
if (rt->name)
TsanPrintf(" '%s'", rt->name);
- TsanPrintf(" (tid=%d, %s)", rt->pid, rt->running ? "running" : "finished");
+ TsanPrintf(" (tid=%zu, %s)", rt->pid, rt->running ? "running" : "finished");
if (rt->stack)
TsanPrintf(" created at:");
TsanPrintf("\n");
struct ReportThread {
int id;
- int pid;
+ uptr pid;
bool running;
char *name;
ReportStack *stack;
struct ThreadContext {
const int tid;
int unique_id; // Non-rolling thread id.
- int os_id; // pid
+ uptr os_id; // pid
uptr user_id; // Some opaque user thread id (e.g. pthread_t).
ThreadState *thr;
ThreadStatus status;
void FuncExit(ThreadState *thr);
int ThreadCreate(ThreadState *thr, uptr pc, uptr uid, bool detached);
-void ThreadStart(ThreadState *thr, int tid, int os_id);
+void ThreadStart(ThreadState *thr, int tid, uptr os_id);
void ThreadFinish(ThreadState *thr);
int ThreadTid(ThreadState *thr, uptr pc, uptr uid);
void ThreadJoin(ThreadState *thr, uptr pc, int tid);
return tid;
}
-void ThreadStart(ThreadState *thr, int tid, int os_id) {
+void ThreadStart(ThreadState *thr, int tid, uptr os_id) {
CHECK_GT(thr->in_rtl, 0);
uptr stk_addr = 0;
uptr stk_size = 0;