From 72aca2e8034f48eff3b88af1a171a56e3010b57d Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 12 Mar 2014 15:17:33 +0100 Subject: [PATCH] New function: xbt_os_thread_setguardsize (like pthread_attr_setguardsize). --- include/xbt/xbt_os_thread.h | 1 + src/xbt/xbt_os_thread.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/xbt/xbt_os_thread.h b/include/xbt/xbt_os_thread.h index eede122294..655c8826ff 100644 --- a/include/xbt/xbt_os_thread.h +++ b/include/xbt/xbt_os_thread.h @@ -68,6 +68,7 @@ XBT_PUBLIC(void) xbt_os_thread_yield(void); XBT_PUBLIC(void) xbt_os_thread_cancel(xbt_os_thread_t thread); XBT_PUBLIC(void *) xbt_os_thread_getparam(void); XBT_PUBLIC(void) xbt_os_thread_setstacksize(int stack_size); +XBT_PUBLIC(void) xbt_os_thread_setguardsize(int guard_size); /** \brief Thread mutex data type (opaque structure) */ typedef struct xbt_os_mutex_ *xbt_os_mutex_t; diff --git a/src/xbt/xbt_os_thread.c b/src/xbt/xbt_os_thread.c index ed0a8acd82..f29549575c 100644 --- a/src/xbt/xbt_os_thread.c +++ b/src/xbt/xbt_os_thread.c @@ -230,6 +230,14 @@ void xbt_os_thread_setstacksize(int stack_size) XBT_WARN("unknown error %d in pthread stacksize setting: %zd", res, sz); } +void xbt_os_thread_setguardsize(int guard_size) +{ + size_t sz = guard_size; + int res = pthread_attr_setguardsize(&thread_attr, sz); + if (res) + XBT_WARN("pthread_attr_setguardsize failed (%d) for size: %zd", res, sz); +} + const char *xbt_os_thread_name(xbt_os_thread_t t) { return t->name; @@ -758,6 +766,11 @@ void xbt_os_thread_setstacksize(int size) stack_size = size; } +void xbt_os_thread_setguardsize(int size) +{ + XBT_WARN("xbt_os_thread_setguardsize is not implemented (%d)", size); +} + const char *xbt_os_thread_name(xbt_os_thread_t t) { return t->name; -- 2.20.1