Boost logo

Boost :

Subject: [boost] [fiber] Mac OS X
From: Daniel Larimer (dlarimer_at_[hidden])
Date: 2011-01-28 22:22:35


I am attempting to use Boost.Fiber on Mac OS X, but it always crashes in makecontext() which is now deprecated on Mac OS X. Is there any plan to get asm working for OS X?

include <boost/fiber.hpp>

boost::fiber* fi;

void fib()
{
    for( int i = 0; i < 10; ++i )
        fi->yield();

};

int main( int argc, char** argv )
{
    boost::fiber f( boost::bind(fib), boost::fiber::default_stacksize, boost::protected_stack_allocator());
    fi = &f;
    f.run();

    return 0;
}

Reason: KERN_INVALID_ADDRESS at address: 0x0000000000010fa0
0x00007fff80820f89 in makecontext ()
(gdb) bt
#0 0x00007fff80820f89 in makecontext ()
#1 0x000000010001f3a3 in boost::contexts::context::impl_t::impl_t (this=0x100100210, fn=0x100016990 <boost::fibers::detail::trampoline(void*)>, vp=0x100100190, stacksize=65536, nxt=0x1001001c0, alloc_=<value temporarily unavailable, due to optimizations>) at libs/context/src/context_ucontext.cpp:58
#2 0x000000010001f183 in ~auto_ptr [inlined] () at /usr/include/c++/4.2.1/memory:59
#3 0x000000010001f183 in boost::contexts::context::init_ (fn=0x100016990 <boost::fibers::detail::trampoline(void*)>, nxt=0x1001001a0, vp=0x100100190, stacksize=65536, alloc=<value temporarily unavailable, due to optimizations>) at libs/context/src/context_ucontext.cpp:77
#4 0x00000001000017db in boost::contexts::context::create<boost::contexts::protected_stack_allocator> ()
#5 0x0000000100001a96 in boost::fibers::detail::fiber_base::fiber_base<boost::contexts::protected_stack_allocator> ()
#6 0x0000000100001b65 in boost::fibers::detail::fiber_object<boost::_bi::bind_t<void, void (*)(), boost::_bi::list0> >::fiber_object<boost::contexts::protected_stack_allocator> ()
#7 0x0000000100001bdd in boost::fibers::fiber::make_fiber_<boost::_bi::bind_t<void, void (*)(), boost::_bi::list0>, boost::contexts::protected_stack_allocator> ()
#8 0x0000000100001c54 in boost::fibers::fiber::fiber<boost::_bi::bind_t<void, void (*)(), boost::_bi::list0>, boost::contexts::protected_stack_allocator> ()
#9 0x00000001000010be in main ()

Boost 1.45
Boost.Fiber 0.7.0 from Valut
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)
Mac OS X 10.6.6


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk