Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
New function: xbt_os_thread_setguardsize (like pthread_attr_setguardsize).
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 12 Mar 2014 14:17:33 +0000 (15:17 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Mon, 17 Mar 2014 10:53:58 +0000 (11:53 +0100)
include/xbt/xbt_os_thread.h
src/xbt/xbt_os_thread.c

index eede122..655c882 100644 (file)
@@ -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;
index ed0a8ac..f295495 100644 (file)
@@ -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;