apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Spinka, Kristofer" <kspi...@style.net>
Subject [PATCH]: threadproc/unix/thread.c (part of stack size patch group)
Date Fri, 04 Apr 2003 10:08:15 GMT
--- threadproc/unix/thread.c    Fri Apr  4 04:47:30 2003
+++ threadproc/unix/thread.c.new        Fri Apr  4 04:32:48 2003
@@ -84,6 +84,52 @@
     return stat;
 }
 
+APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t
*attr,
+                                                       apr_size_t
size_in_bytes)
+{
+    apr_status_t stat;
+#ifdef PTHREAD_ATTR_SETSTACKSIZE_ARG2_ADDR
+    apr_size_t arg = size_in_bytes;
+
+    if ((stat = pthread_attr_setstacksize(attr->attr, &arg)) == 0) {
+#else
+    if ((stat = pthread_attr_setstacksize(attr->attr, size_in_bytes))
== 0) {
+#endif
+
+        return APR_SUCCESS;
+    }
+    else {
+#ifdef PTHREAD_SETS_ERRNO
+        stat = errno;
+#endif
+
+        return stat;
+    }
+}
+
+APR_DECLARE(apr_status_t) apr_threadattr_stacksize_get(apr_threadattr_t
*attr,
+                                                       apr_size_t
*size_in_bytes)
+{
+    apr_status_t stat;
+#ifdef PTHREAD_ATTR_GETSTACKSIZE_TAKES_ONE_ARG
+    apr_size_t size_returned;
+
+    size_returned = pthread_attr_getstacksize(attr->attr);
+#else
+    if ((stat = pthread_attr_getstacksize(attr->attr, size_in_bytes))
== 0) {
+#endif
+
+        return APR_SUCCESS;
+    }
+    else {
+#ifdef PTHREAD_SETS_ERRNO
+        stat = errno;
+#endif
+
+        return stat;
+    }
+}
+
 APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t
*attr,
                                                     apr_int32_t on)
 {

   /kristofer


Mime
View raw message