Module: xenomai-2.4 Branch: master Commit: 397dc40d3d6fe46c91472b21946b73aa2ea0c5fe URL: http://git.xenomai.org/?p=xenomai-2.4.git;a=commit;h=397dc40d3d6fe46c91472b21946b73aa2ea0c5fe
Author: Philippe Gerum <r...@xenomai.org> Date: Wed Jul 15 12:42:58 2009 +0200 nucleus: fix potential init race of the main pod --- ksrc/nucleus/pod.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c index 5eef706..9348ce1 100644 --- a/ksrc/nucleus/pod.c +++ b/ksrc/nucleus/pod.c @@ -256,15 +256,18 @@ int xnpod_init(void) xnlock_get_irqsave(&nklock, s); - if (xnpod_active_p()) { - /* Another skin has initialized the global pod - * already; just increment the reference count. */ + pod = &nkpod_struct; + if (pod->refcnt > 0) { + /* + * Another skin has already initialized, or is + * currently initializing the global pod already; just + * increment the reference count and bail out. + */ ++nkpod->refcnt; xnlock_put_irqrestore(&nklock, s); return 0; } - pod = &nkpod_struct; pod->status = 0; pod->refcnt = 1; _______________________________________________ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git