summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorstorri <storri@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-01-17 02:15:43 +0000
committerstorri <storri@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-01-17 02:15:43 +0000
commit2710cbb18c49fd6c363244bf4da0048c7d801b02 (patch)
treeae8d70b0c174fc49f6ee6b78cdbb8fc8cd48a129 /ace
parentfbf044a3b5ee56f8c888871165ef806651b90767 (diff)
downloadATCD-2710cbb18c49fd6c363244bf4da0048c7d801b02.tar.gz
Adding changes for pthread_setstack
Diffstat (limited to 'ace')
-rw-r--r--ace/OS.cpp10
-rw-r--r--ace/README1
-rw-r--r--ace/config-linux-common.h5
3 files changed, 16 insertions, 0 deletions
diff --git a/ace/OS.cpp b/ace/OS.cpp
index 1146dc46091..bd51e9eb87f 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -2581,7 +2581,11 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
stacksize = ACE_CHORUS_DEFAULT_MIN_STACK_SIZE;
# endif /*CHORUS */
+# if defined (ACE_HAS_PTHREAD_SETSTACK)
+ if ((stacksize != 0) && (stack != 0))
+# else
if (stacksize != 0)
+# endif /* ACE_HAS_PTHREAD_SETSTACK */
{
size_t size = stacksize;
@@ -2592,7 +2596,11 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
# if !defined (ACE_LACKS_THREAD_STACK_SIZE) // JCEJ 12/17/96
# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6)
+# if !defined (ACE_HAS_PTHREAD_SETSTACK)
+      if (::pthread_attr_setstack (&attr, stack, size) != 0)
+# else
if (::pthread_attr_setstacksize (&attr, size) != 0)
+# endif /* ACE_HAS_PTHREAD_SETSTACK */
# else
if (ACE_ADAPT_RETVAL(pthread_attr_setstacksize (&attr, size), result) == -1)
# endif /* ACE_HAS_PTHREADS_DRAFT4, 6 */
@@ -2610,6 +2618,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
}
// *** Set Stack Address
+# if !defined (ACE_HAS_PTHREAD_SETSTACK)
# if !defined (ACE_LACKS_THREAD_STACK_ADDR)
if (stack != 0)
{
@@ -2626,6 +2635,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
# else
ACE_UNUSED_ARG (stack);
# endif /* !ACE_LACKS_THREAD_STACK_ADDR */
+# endif /* ACE_HAS_PTHREAD_SETSTACK */
// *** Deal with various attributes
if (flags != 0)
diff --git a/ace/README b/ace/README
index 26236743a11..4a9483d0763 100644
--- a/ace/README
+++ b/ace/README
@@ -477,6 +477,7 @@ ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP Platform has
ACE_HAS_PTHREAD_PROCESS_ENUM pthread.h declares an enum with
PTHREAD_PROCESS_PRIVATE and
PTHREAD_PROCESS_SHARED values.
+ACE_HAS_PTHREAD_SETSTACK                Platform has pthread_attr_setstack().      
ACE_HAS_PURIFY Purify'ing. Set by wrapper_macros.GNU.
ACE_HAS_QUANTIFY Quantify'ing. Set by wrapper_macros.GNU.
ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS Platform will recurse
diff --git a/ace/config-linux-common.h b/ace/config-linux-common.h
index 8c942cbc86d..a2388a0063c 100644
--- a/ace/config-linux-common.h
+++ b/ace/config-linux-common.h
@@ -324,4 +324,9 @@
// Enables use of POSIX termios struct
#define ACE_USES_NEW_TERMIOS
+// Use new pthread_attr_setstack
+#if defined (__USE_XOPEN2K) && (__GLIBC__ > 2 || ( __GLIBC__ == 2 && __GLIBC_MINOR__ >=2))
+#define ACE_HAS_PTHREAD_SETSTACK
+#endif /* __USE_XOPEN2K && glibc >2.2 */
+
#endif /* ACE_LINUX_COMMON_H */