0

Is there any universal solution to recover a pthread_t value for current thread context?

The code is required for a loadable .so for multithreaded app, so I want to somehow receive library's thread id to understand this thing better - using gdb (details at this question).

The app may utilize Boost, GLib, thousand of other pthreads wrappers - I don't care, just need the actual thread ID without modifying app's source.

Community
  • 1
  • 1
kagali-san
  • 2,964
  • 7
  • 48
  • 87

1 Answers1

2

Yes - just call pthread_self() to get the pthread_t for the current thread.

TomH
  • 8,900
  • 2
  • 32
  • 30