[Vortex] Thread ID
"Robert M. Münch"
robert.muench at robertmuench.de
Sun Aug 21 14:12:32 CEST 2011
Am 16.08.2011 um 09:41 schrieb Francis Brosnan Blazquez:
> I found your message discarded (you are not subscribed with
> saphirion.com domain)
Ups, that's my business address… using my private one.
>> Hi, is it possible to access the thread ID of a Vortex thread?
>
> This is highly dependant on your OS...because vortex uses OS threads,
> check OS thread documentation to get this safely..
I tried and didn't find anything simple to get the thread ID on OSX, only the process ID.
>> I need to log from my handlers and need the ID to distinguish
>> from which thread the handler was called. I'm on OSX, where
>> gettid() is not available. getpid() only returns the same
>> value for all threads so doesn't help too.
>>
>> pthread_self() doesn't help again, as it seems to return a
>> struct, but I can't access its members as there are opaque and
>> immediately create a bus error on OSX.
>
> Ok, assuming pthread_self is an address memory, you can just use that as
> identifier:
>
> printf ("%d\n", PTR_TO_INT (pthread_self()));
I will try this.
> Checking pthread_self manual, reveals there is a gettid call that
> provides just what you are looking but I'm not sure if it is available
> on MAC OS/X…..
No it's not available, that's the problem :) Maybe anyone else knows how to get the thread ID on OSX in a simple way. Robert
More information about the Vortex
mailing list