tags:

views:

15

answers:

1

I am using glib for creating threads:

g_thread_create()

How can I acquire thread id (number)?

A: 

You can't. The thread ID is abstracted away in GLib. What do you need it for?

ptomato
For debug purposes. I wanted to print tid in error_log with error message.
Marko Kevac
If you want a unique symbol for each thread, you can `printf("%p\n", g_thread_self());` This will give you the address of the `GThread` structure, so you can tell your threads apart.
ptomato