Module: xenomai-3
Branch: master
Commit: 0a880f32f3ce42423fa11527c047de5bc6e64e44
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=0a880f32f3ce42423fa11527c047de5bc6e64e44

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Tue Apr 21 16:07:01 2015 +0200

lib/cobalt: Introduce and use COBALT_STACKSIZE_DEFAULT

Allows to remove cobalt_get_stacksize.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 include/cobalt/sys/cobalt.h |    2 --
 lib/cobalt/internal.c       |   17 -----------------
 lib/cobalt/internal.h       |    3 +++
 lib/cobalt/printf.c         |    2 +-
 4 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/include/cobalt/sys/cobalt.h b/include/cobalt/sys/cobalt.h
index 67f419e..f124ca6 100644
--- a/include/cobalt/sys/cobalt.h
+++ b/include/cobalt/sys/cobalt.h
@@ -65,8 +65,6 @@ int cobalt_thread_stat(pid_t pid,
 
 int cobalt_serial_debug(const char *fmt, ...);
 
-size_t cobalt_get_stacksize(size_t size);
-
 void __cobalt_commit_memory(void *p, size_t len);
 
 void cobalt_thread_harden(void);
diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c
index cf2971a..d154f26 100644
--- a/lib/cobalt/internal.c
+++ b/lib/cobalt/internal.c
@@ -143,23 +143,6 @@ int cobalt_serial_debug(const char *fmt, ...)
        return ret;
 }
 
-size_t cobalt_get_stacksize(size_t size)
-{
-       static const size_t default_size = PTHREAD_STACK_MIN * 4;
-       static size_t min_size;
-
-       if (min_size == 0)
-               min_size = PTHREAD_STACK_MIN + getpagesize();
-
-       if (size == 0)
-               size = default_size;
-
-       if (size < min_size)
-               size = min_size;
-
-       return size;
-}
-
 static inline
 struct cobalt_monitor_state *get_monitor_state(cobalt_monitor_t *mon)
 {
diff --git a/lib/cobalt/internal.h b/lib/cobalt/internal.h
index e126480..f5f119e 100644
--- a/lib/cobalt/internal.h
+++ b/lib/cobalt/internal.h
@@ -18,9 +18,12 @@
 #ifndef _LIB_COBALT_INTERNAL_H
 #define _LIB_COBALT_INTERNAL_H
 
+#include <limits.h>
 #include <cobalt/sys/cobalt.h>
 #include "current.h"
 
+#define COBALT_STACKSIZE_DEFAULT       (PTHREAD_STACK_MIN * 4)
+
 extern void *cobalt_umm_private;
 
 extern void *cobalt_umm_shared;
diff --git a/lib/cobalt/printf.c b/lib/cobalt/printf.c
index f19f4ea..4e1dff3 100644
--- a/lib/cobalt/printf.c
+++ b/lib/cobalt/printf.c
@@ -666,7 +666,7 @@ static void spawn_printer_thread(void)
        pthread_attr_t thattr;
 
        pthread_attr_init(&thattr);
-       pthread_attr_setstacksize(&thattr, cobalt_get_stacksize(0));
+       pthread_attr_setstacksize(&thattr, COBALT_STACKSIZE_DEFAULT);
        pthread_create(&printer_thread, &thattr, printer_loop, NULL);
 }
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to