MySQL  8.0.27
Source Code Documentation
my_thread_os_id.h File Reference

Portable wrapper for gettid(). More...

#include "my_config.h"
#include "my_macros.h"
#include "my_thread.h"
#include <sys/syscall.h>
#include <unistd.h>

Go to the source code of this file.

Typedefs

typedef unsigned long long my_thread_os_id_t
 

Functions

static my_thread_os_id_t my_thread_os_id ()
 Return the operating system thread id. More...
 

Detailed Description

Portable wrapper for gettid().

Typedef Documentation

◆ my_thread_os_id_t

typedef unsigned long long my_thread_os_id_t

Function Documentation

◆ my_thread_os_id()

static my_thread_os_id_t my_thread_os_id ( )
inlinestatic

Return the operating system thread id.

With Linux, threads have:

  • an internal id, pthread_self(), visible in process
  • an external id, gettid(), visible in the operating system, for example with perf in linux. This helper returns the underling operating system thread id.