Fix gettid() naming conflict

pull/20048/head
Juanli Shen 6 years ago
parent fe2fb14d07
commit de6255941a
  1. 6
      src/core/lib/gpr/log_linux.cc

@ -40,7 +40,9 @@
#include <time.h>
#include <unistd.h>
static long gettid(void) { return syscall(__NR_gettid); }
// Not naming it as gettid() to avoid duplicate declarations when complied with
// GCC 9.1.
static long local_gettid(void) { return syscall(__NR_gettid); }
void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) {
@ -70,7 +72,7 @@ void gpr_default_log(gpr_log_func_args* args) {
gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
struct tm tm;
static __thread long tid = 0;
if (tid == 0) tid = gettid();
if (tid == 0) tid = local_gettid();
timer = static_cast<time_t>(now.tv_sec);
final_slash = strrchr(args->file, '/');

Loading…
Cancel
Save