<< Back to Codezero API Reference
int l4_getid(struct task_ids *ids);
Thread ID, Thread Group ID, and Space ID are received via the ids structure.
Every thread in the system has a globally unique Thread ID.
An address space may have one or more threads. Therefore threads may share their Space IDs.
A Thread Group Leader has a Thread ID same as its Thread Group ID.
A newly created thread may join an existing thread group or create a new group. This behaviour is defined by the thread's pager.
struct task_ids {
int tid; /* Thread ID */
int spid; /* Space ID */
int tgid; /* Thread Group ID */
};
/* Returns Thread ID of current thread */
static inline l4id_t self_tid(void)
{
struct task_ids ids;
l4_getid(&ids);
return ids.tid;
}