Permalink
Browse files

Merge git://github.com/abigagli/libcppa into unstable

  • Loading branch information...
2 parents 241da2d + 668dcb5 commit 49881cc2d79b11eeba18eb14da3031555647f79b @Neverlord Neverlord committed Feb 18, 2013
Showing with 20 additions and 1 deletion.
  1. +20 −1 src/fiber.cpp
View
@@ -56,6 +56,9 @@ void fiber::swap(fiber&, fiber&) {
#endif
#include <boost/version.hpp>
#include <boost/context/all.hpp>
+#if BOOST_VERSION >= 105300
+#include <boost/coroutine/all.hpp>
+#endif
namespace cppa { namespace util {
@@ -96,10 +99,25 @@ inline void fc_make(fc_member& storage, fc_allocator& alloc, vg_member& vgm) {
reinterpret_cast<void*>(
reinterpret_cast<intptr_t>(storage.fc_stack.base) - stacksize));
}
+#elif BOOST_VERSION < 105300
+namespace ctx = boost::context;
+typedef ctx::fcontext_t* fc_member;
+typedef ctx::guarded_stack_allocator fc_allocator
+inline void fc_jump(fc_member& from, fc_member& to, fiber_impl* ptr) {
+ ctx::jump_fcontext(from, to, (intptr_t) ptr);
+}
+inline void fc_make(fc_member& storage, fc_allocator& alloc, vg_member& vgm) {
+ size_t mss = fc_allocator::minimum_stacksize();
+ storage = ctx::make_fcontext(alloc.allocate(mss), mss, fiber_trampoline);
+ vg_register(vgm,
+ storage->fc_stack.sp,
+ reinterpret_cast<void*>(
+ reinterpret_cast<intptr_t>(storage->fc_stack.sp) - mss));
+}
#else
namespace ctx = boost::context;
typedef ctx::fcontext_t* fc_member;
-typedef ctx::guarded_stack_allocator fc_allocator;
+typedef boost::coroutines::stack_allocator fc_allocator;
inline void fc_jump(fc_member& from, fc_member& to, fiber_impl* ptr) {
ctx::jump_fcontext(from, to, (intptr_t) ptr);
}
@@ -111,6 +129,7 @@ inline void fc_make(fc_member& storage, fc_allocator& alloc, vg_member& vgm) {
reinterpret_cast<void*>(
reinterpret_cast<intptr_t>(storage->fc_stack.sp) - mss));
}
+
#endif
} // namespace <anonymous>

0 comments on commit 49881cc

Please sign in to comment.