Re: getting a unique thread id?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Moin Friedrich,

> I have a question about thread in glib. AFAIKT there is not api
> function for getting the some sort of unique thread id. The only
> function which comes near is:
> g_thread_self, but there is not structure but privat or so which could
> yield the id of the thread. However how can that be achieved?

g_thread_self gives you a thread ID in the sense, that it's unique (no
two different threads have the same ID) and it's persistent (a thread
will always return the same value [of course not in two different
programs runs]).

But it is not a thread ID in the sense, that it's a low number, usable
for indexing a table or such. If you need that, use GStaticPrivate,
which gets initialized (the first time it's accesses) by a global
counter, which is then increased.

/ Sebastian
-- 
Sebastian Wilhelmi
wilhelmi@xxxxxxxxxx
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux