Thread IDs
Peter Nguyen
peter.nguyen at ...29...
Wed Jan 20 12:11:41 CET 2010
I was more wondering how to get the numerical ID of the thread after
i've created one. Is it possible to obtain that at all?
Peter
On 19/01/2010, at 8:06 PM, Stefan Kalkowski wrote:
> Hi Peter,
>
> On Tuesday, 19. January 2010 06:30:22 Peter Nguyen wrote:
>> Hi,
>>
>> So I've done some more messing around with genode (running on top
>> of OKL4),
>> more specifically creating some threads, and testing the
>> functionality in
>> general. I'm wondering how i can go about obtaining the thread's ID
>> and
>> printing it out. I've noticed that there are functions that are
>> within the
>> Thread class that can get me a Native_thread_id, but currently I
>> can't seem
>> to do much with it.
>>
>> Speaking of the native thread, is that type related to L4? Can I
>> actually
>> get a numerical value for that ID?
>
> that's right, 'Native_thread_id' is the platform-specific thread
> representation, so in the OKL4-case it is 'L4_ThreadId_t' indeed. The
> kernel-specific thread id in Genode/OKL4 is a member of
> 'Thread_state' a
> thread property, that can be obtained via the cpu-session interface.
>
> Although, it is recommended to use only generic Genode abstractions
> to stay
> platform-independent, if you've to deal with the kernel-api
> directly, you
> might use the cpu-session interface to gain some platform-specific
> thread
> data within 'Thread_state'.
>
> Here is some example code, printing all OKL4 thread IDs of one cpu-
> session:
>
> int i;
> Genode::Thread_state state;
> Genode::Thread_capability tcap = Genode::env()->cpu_session()-
> >first();
> while(tcap.valid())
> {
> Genode::env()->cpu_session()->state(tcap, &state);
> PDBG("tid of thread no. %d is %lx", i, state.tid.raw);
> tcap = Genode::env()->cpu_session()->next(tcap);
> ++i;
> }
>
> Thereby, the order of the threads given by cpu-session's iterator
> isn't
> necessarily the order of the thread's creation time!
>
> Regards
> Stefan
>
>>
>> Peter
>>
>> ---------------------------------------------------------------------------
>> --- Throughout its 18-year history, RSA Conference consistently
>> attracts the
>> world's best and brightest in the field, creating opportunities for
>> Conference attendees to learn about information security's most
>> important
>> issues through interactions with peers, luminaries and emerging and
>> established companies. http://p.sf.net/sfu/rsaconf-dev2dev
>> _______________________________________________
>> Genode-main mailing list
>> Genode-main at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/genode-main
>
>
>
> --
> Stefan Kalkowski
> Genode Labs Developer
> http://genode-labs.com
>
> ------------------------------------------------------------------------------
> Throughout its 18-year history, RSA Conference consistently attracts
> the
> world's best and brightest in the field, creating opportunities for
> Conference
> attendees to learn about information security's most important
> issues through
> interactions with peers, luminaries and emerging and established
> companies.
> http://p.sf.net/sfu/rsaconf-dev2dev
> _______________________________________________
> Genode-main mailing list
> Genode-main at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/genode-main
More information about the users
mailing list