stack_context.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Copyright Oliver Kowalke 2009.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef BOOST_COROUTINES_STACK_CONTEXT_H
  6. #define BOOST_COROUTINES_STACK_CONTEXT_H
  7. #include <cstddef>
  8. #include <boost/config.hpp>
  9. #include <boost/coroutine/detail/config.hpp>
  10. #ifdef BOOST_HAS_ABI_HEADERS
  11. # include BOOST_ABI_PREFIX
  12. #endif
  13. namespace boost {
  14. namespace coroutines {
  15. #if defined(BOOST_USE_SEGMENTED_STACKS)
  16. struct BOOST_COROUTINES_DECL stack_context
  17. {
  18. typedef void * segments_context[BOOST_CONTEXT_SEGMENTS];
  19. std::size_t size;
  20. void * sp;
  21. segments_context segments_ctx;
  22. #if defined(BOOST_USE_VALGRIND)
  23. unsigned valgrind_stack_id;
  24. #endif
  25. stack_context() :
  26. size( 0), sp( 0), segments_ctx()
  27. #if defined(BOOST_USE_VALGRIND)
  28. , valgrind_stack_id( 0)
  29. #endif
  30. {}
  31. };
  32. #else
  33. struct BOOST_COROUTINES_DECL stack_context
  34. {
  35. std::size_t size;
  36. void * sp;
  37. #if defined(BOOST_USE_VALGRIND)
  38. unsigned valgrind_stack_id;
  39. #endif
  40. stack_context() :
  41. size( 0), sp( 0)
  42. #if defined(BOOST_USE_VALGRIND)
  43. , valgrind_stack_id( 0)
  44. #endif
  45. {}
  46. };
  47. #endif
  48. }}
  49. #ifdef BOOST_HAS_ABI_HEADERS
  50. # include BOOST_ABI_SUFFIX
  51. #endif
  52. #endif // BOOST_COROUTINES_STACK_CONTEXT_H