Module: xenomai-head
Branch: master
Commit: 5eca9ad4f99ab129bbdc9dcecee83cca1d69861d
URL:    
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=5eca9ad4f99ab129bbdc9dcecee83cca1d69861d

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sun Apr  3 16:01:44 2011 +0200

common: run arch-dep features init only once

---

 src/skins/common/bind.c |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/skins/common/bind.c b/src/skins/common/bind.c
index fd68198..fe98fdb 100644
--- a/src/skins/common/bind.c
+++ b/src/skins/common/bind.c
@@ -80,6 +80,20 @@ int __xnsig_dispatch_safe(struct xnsig *sigs, int 
cumulated_error, int last_erro
 }
 #endif /* XENOMAI_SYSSIGS_SAFE */
 
+#ifdef xeno_arch_features_check
+static void do_init_arch_features(void)
+{
+       xeno_arch_features_check(&xeno_featinfo);
+}
+static void xeno_init_arch_features(void)
+{
+       static pthread_once_t init_archfeat_once = PTHREAD_ONCE_INIT;
+       pthread_once(&init_archfeat_once, do_init_arch_features);
+}
+#else  /* !xeno_init_arch_features */
+#define xeno_init_arch_features()      do { } while (0)
+#endif /* !xeno_arch_features_check */
+
 int
 xeno_bind_skin_opt(unsigned skin_magic, const char *skin,
                   const char *module, xnsighandler *handler)
@@ -136,16 +150,14 @@ xeno_bind_skin_opt(unsigned skin_magic, const char *skin,
 
        xnsig_handlers[muxid] = handler;
 
-#ifdef xeno_arch_features_check
-       xeno_arch_features_check(&finfo);
-#endif /* xeno_arch_features_check */
+       xeno_featinfo = finfo;
+
+       xeno_init_arch_features();
 
        xeno_init_sem_heaps();
 
        xeno_init_current_keys();
 
-       xeno_featinfo = finfo;
-
        xeno_main_tid = pthread_self();
 
        xeno_init_timeconv(muxid);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to