[context] Windows ctx::maximum_stacksize() runtime asserts

Hey all, The Windows implementation of boost::ctx::maximum_stacksize() does always assert: std::size_t maximum_stacksize() { BOOST_ASSERT( ! is_stack_unbound() ); static std::size_t stacksize = 8 * 1024 * 1024; return stacksize; } That is because is_stack_unbound() will unconditionally return true. Patch is attached - ok to commit? Regards Hartmut --------------- http://boost-spirit.com http://stellar.cct.lsu.edu

Am 02.09.2012 01:33, schrieb Hartmut Kaiser:
Hey all,
The Windows implementation of boost::ctx::maximum_stacksize() does always assert:
std::size_t maximum_stacksize() { BOOST_ASSERT( ! is_stack_unbound() ); static std::size_t stacksize = 8 * 1024 * 1024; return stacksize; }
the assert statement is a pre-condition of maximum_stacksize(). is_stack_unbound() returns true if the stack is not limited. calling maximum_stacksize() is only allowed if is_stack_unbound() returns false. this is a issue required by posix getrlimit() - the max stacksize to a certain value or unlimited (== RLIM_INFINITY). Oliver

The Windows implementation of boost::ctx::maximum_stacksize() does always assert:
std::size_t maximum_stacksize() { BOOST_ASSERT( ! is_stack_unbound() ); static std::size_t stacksize = 8 * 1024 * 1024; return stacksize; }
the assert statement is a pre-condition of maximum_stacksize(). is_stack_unbound() returns true if the stack is not limited. calling maximum_stacksize() is only allowed if is_stack_unbound() returns false. this is a issue required by posix getrlimit() - the max stacksize to a certain value or unlimited (== RLIM_INFINITY).
Ok. The code does not make any sense to me anyways as on Windows this will _always_ assert. Why try to return a sensible number is this case at all? Regards Hartmut --------------- http://boost-spirit.com http://stellar.cct.lsu.edu
participants (2)
-
Hartmut Kaiser
-
Oliver Kowalke