Re: getting a unique thread id?
- From: "Sebastian Wilhelmi" <wilhelmi google com>
- To: "Friedrich Dominicus" <frido q-software-solutions de>
- Cc: gtk-list gnome org
- Subject: Re: getting a unique thread id?
- Date: Wed, 26 Jul 2006 14:17:44 +0200
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 google com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]