From 1b6962813dfd442167a04baa8ce260b822a9d18d Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 9 Dec 2006 22:10:45 +0100 Subject: [PATCH] Configure default thread stack size globally. --- lib/Makefile | 2 +- lib/threads-conf.c | 27 +++++++++++++++++++++++++++ lib/threads.h | 6 ++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 lib/threads-conf.c diff --git a/lib/Makefile b/lib/Makefile index d75761a5..be93256d 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -58,7 +58,7 @@ LIBUCW_INCLUDES= \ ifdef CONFIG_UCW_THREADS # Some modules require threading LIBS+=-lpthread -LIBUCW_MODS+=workqueue asio fb-direct +LIBUCW_MODS+=threads-conf workqueue asio fb-direct LIBUCW_INCLUDES+=workqueue.h asio.h endif diff --git a/lib/threads-conf.c b/lib/threads-conf.c new file mode 100644 index 00000000..f3ac5a2f --- /dev/null +++ b/lib/threads-conf.c @@ -0,0 +1,27 @@ +/* + * The UCW Library -- Threading Helpers + * + * (c) 2006 Martin Mares + * + * This software may be freely distributed and used according to the terms + * of the GNU Lesser General Public License. + */ + +#include "lib/lib.h" +#include "lib/threads.h" +#include "lib/conf.h" + +uns default_thread_stack_size = 65556; + +static struct cf_section threads_config = { + CF_ITEMS { + CF_UNS("DefaultStackSize", &default_thread_stack_size), + CF_END + } +}; + +static void CONSTRUCTOR +ucwlib_threads_conf_init(void) +{ + cf_declare_section("Threads", &threads_config, 0); +} diff --git a/lib/threads.h b/lib/threads.h index 70534ebb..355902d6 100644 --- a/lib/threads.h +++ b/lib/threads.h @@ -24,4 +24,10 @@ struct ucwlib_context *ucwlib_thread_context(void); void ucwlib_lock(void); void ucwlib_unlock(void); +#ifdef CONFIG_UCW_THREADS + +extern uns default_thread_stack_size; + +#endif + #endif -- 2.39.2