I imagine if pthread_self() is the way to get the current thread
ID, then just save that
value early in your main(), before you start any child threads,
and save the value to
a global, then compare that global to pthread_self() later in
your code, e.g.
// main.c pthread_t G_main_tid; // GLOBAL: main thread's
ID ..
int main() { .. G_main_tid = pthread_self(); // save main thread's
ID .. } void some_function() { if ( G_main_tid == pthread_self() ) { // main thread } else { // child thread } }
Comments are owned by the poster. All other content is copyright 1998-2025 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.