Hi Jaeyong,

On 02.11.2012 05:44, jaeyong yoo wrote:
> Hello genode,
> I have a rather simple question.
> At any place in source code, how can I know the thread id?
> 
> For instance, in the body of main function like,
> 
> int main()
> {
> ... blah
>     id = some_action_to_get_thread_id();
> ... blah
> }
> 
> Best,
> Jaeyong

In general in Genode there is no notion of a thread id. Although some
kernels Genode runs on top of provide thread ids the framework tries to
abstract from these. Genode is a capability-based OS framework. That
means it tries to avoid system global names (like thread ids), and
provides local names (capabilities) instead that are in valid in a
corresponding protection-domain only. The idea behind that is: you can
only access what you can name.

With respect to threads, there are specific thread-capabilities which
belong to a corresponding cpu-session (the one the thread was created
by). Using the cpu-session you can do different things with a thread,
like stop/resume, getting it's state, destroying it etc.. For most
threads (by now the only exception is the first thread of a protection
domain) you can obtain it's thread-capability by using the appropriate
thread-object via 'Thread::myself()->cap()'.

I hope this clarifies your question. If for some reason you really need
the actual thread id of a specific kernel, would you please give some
more context about the actual use-case?

Best Regards
Stefan

-- 
Stefan Kalkowski
Genode Labs

http://www.genode-labs.com/ ยท http://genode.org/

------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Genode-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/genode-main

Reply via email to