Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix compilation on Solaris: PTHREAD_STACK_MIN might not be a constant…

…, so evaluate it dynamically. Fixes issue #369.
  • Loading branch information...
commit 5f3ac2b07dcca61321a3cecff666b439a725a3db 1 parent 1779031
@FooBarWidget FooBarWidget authored
Showing with 19 additions and 12 deletions.
  1. +7 −1 NEWS
  2. +12 −11 ext/oxt/thread.hpp
View
8 NEWS
@@ -1,3 +1,9 @@
+Release 2.2.6
+-------------
+
+ * Fixed a compilation problem on Solaris. Issue #369.
+
+
Release 2.2.5
-------------
@@ -134,4 +140,4 @@ Release 2.2.5
Older releases
--------------
-Please consult the blog posts on http://blog.phusion.nl/ for the information about older releases.
+Please consult the blog posts on http://blog.phusion.nl/ for the information about older releases.
View
23 ext/oxt/thread.hpp
@@ -109,15 +109,6 @@ class thread: public boost::thread {
public:
/**
- * The platform's minimum stack size, in bytes.
- */
- #if defined(PTHREAD_STACK_MIN)
- static const unsigned int MIN_STACK_SIZE = PTHREAD_STACK_MIN;
- #else
- static const unsigned int MIN_STACK_SIZE = 1024 * 128;
- #endif
-
- /**
* Create a new thread.
*
* @param func A function object which will be called as the thread's
@@ -139,8 +130,18 @@ class thread: public boost::thread {
initialize_data(name);
set_thread_main_function(boost::bind(thread_main, func, data));
- if (stack_size < MIN_STACK_SIZE) {
- stack_size = MIN_STACK_SIZE;
+
+ unsigned long min_stack_size;
+ #ifdef PTHREAD_STACK_MIN
+ // PTHREAD_STACK_MIN may not be a constant macro so we need
+ // to evaluate it dynamically.
+ min_stack_size = PTHREAD_STACK_MIN;
+ #else
+ // Assume minimum stack size is 128 KB.
+ min_stack_size = 128 * 1024;
+ #endif
+ if (stack_size < min_stack_size) {
+ stack_size = min_stack_size;
}
start_thread(stack_size);
}
Please sign in to comment.
Something went wrong with that request. Please try again.