Module: xenomai-head Branch: master Commit: 42b26f530ed074dd6fe17e0bedf4171788d00b58 URL: http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=42b26f530ed074dd6fe17e0bedf4171788d00b58
Author: Philippe Gerum <r...@xenomai.org> Date: Thu Jul 23 19:33:02 2009 +0200 nucleus: introduce unique id tags for threads A unique non-zero numeric tag is assigned each time a TCB is initialized, at the notable exception of the per-CPU root thread TCBs, which all share a zero tag value. --- include/nucleus/thread.h | 3 +++ ksrc/nucleus/thread.c | 7 +++++++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/include/nucleus/thread.h b/include/nucleus/thread.h index fbd7fec..0372557 100644 --- a/include/nucleus/thread.h +++ b/include/nucleus/thread.h @@ -169,6 +169,7 @@ struct xnsched; struct xnsched_class; struct xnsched_tpslot; union xnsched_policy_param; +struct xnbufd; struct xnthread_operations { int (*get_denormalized_prio)(struct xnthread *, int coreprio); @@ -215,6 +216,8 @@ typedef struct xnthread { struct xnsched_sporadic_data *pss; /* Sporadic scheduling data. */ #endif + unsigned idtag; /* Unique ID tag */ + xnarch_cpumask_t affinity; /* Processor affinity. */ int bprio; /* Base priority (before PIP boost) */ diff --git a/ksrc/nucleus/thread.c b/ksrc/nucleus/thread.c index c8c05cc..68db965 100644 --- a/ksrc/nucleus/thread.c +++ b/ksrc/nucleus/thread.c @@ -24,6 +24,8 @@ #include <nucleus/module.h> #include <asm/xenomai/bits/thread.h> +static unsigned idtags; + static void xnthread_timeout_handler(xntimer_t *timer) { xnthread_t *thread = container_of(timer, xnthread_t, rtimer); @@ -71,6 +73,11 @@ int xnthread_init(struct xnthread *thread, stacksize &= ~(sizeof(long) - 1); } + if (flags & XNROOT) + thread->idtag = 0; + else + thread->idtag = ++idtags ?: 1; + #if CONFIG_XENO_OPT_SYS_STACKPOOLSZ == 0 #ifndef __XENO_SIM__ if (stacksize > 0) { _______________________________________________ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git