type.hpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // Copyright Oliver Kowalke 2013.
  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_FIBERS_TYPE_H
  6. #define BOOST_FIBERS_TYPE_H
  7. #include <atomic>
  8. #include <chrono>
  9. #include <exception>
  10. #include <functional>
  11. #include <map>
  12. #include <memory>
  13. #include <type_traits>
  14. #include <boost/assert.hpp>
  15. #include <boost/config.hpp>
  16. #include <boost/context/detail/apply.hpp>
  17. #include <boost/context/stack_context.hpp>
  18. #include <boost/intrusive/list.hpp>
  19. #include <boost/intrusive/parent_from_member.hpp>
  20. #include <boost/intrusive_ptr.hpp>
  21. #include <boost/intrusive/set.hpp>
  22. #include <boost/fiber/detail/config.hpp>
  23. #include <boost/fiber/detail/data.hpp>
  24. #include <boost/fiber/detail/decay_copy.hpp>
  25. #include <boost/fiber/detail/fss.hpp>
  26. #include <boost/fiber/detail/spinlock.hpp>
  27. #include <boost/fiber/exceptions.hpp>
  28. #include <boost/fiber/fixedsize_stack.hpp>
  29. #include <boost/fiber/properties.hpp>
  30. #include <boost/fiber/segmented_stack.hpp>
  31. #ifdef BOOST_HAS_ABI_HEADERS
  32. # include BOOST_ABI_PREFIX
  33. #endif
  34. namespace boost {
  35. namespace fibers {
  36. enum class type {
  37. none = 0,
  38. main_context = 1 << 1,
  39. dispatcher_context = 1 << 2,
  40. worker_context = 1 << 3,
  41. pinned_context = main_context | dispatcher_context
  42. };
  43. inline
  44. constexpr type
  45. operator&( type l, type r) {
  46. return static_cast< type >(
  47. static_cast< unsigned int >( l) & static_cast< unsigned int >( r) );
  48. }
  49. inline
  50. constexpr type
  51. operator|( type l, type r) {
  52. return static_cast< type >(
  53. static_cast< unsigned int >( l) | static_cast< unsigned int >( r) );
  54. }
  55. inline
  56. constexpr type
  57. operator^( type l, type r) {
  58. return static_cast< type >(
  59. static_cast< unsigned int >( l) ^ static_cast< unsigned int >( r) );
  60. }
  61. inline
  62. constexpr type
  63. operator~( type l) {
  64. return static_cast< type >( ~static_cast< unsigned int >( l) );
  65. }
  66. inline
  67. type &
  68. operator&=( type & l, type r) {
  69. l = l & r;
  70. return l;
  71. }
  72. inline
  73. type &
  74. operator|=( type & l, type r) {
  75. l = l | r;
  76. return l;
  77. }
  78. inline
  79. type &
  80. operator^=( type & l, type r) {
  81. l = l ^ r;
  82. return l;
  83. }
  84. }}
  85. #ifdef BOOST_HAS_ABI_HEADERS
  86. # include BOOST_ABI_SUFFIX
  87. #endif
  88. #endif // BOOST_FIBERS_TYPE_H