
15 Jan
2011
15 Jan
'11
3:33 p.m.
Am 15.01.2011 16:03, schrieb vicente.botet:
The function pointer is not a callback it is the function executed in the context and the void ptr is its argument.
If you require to use boost.function you could easily create an object containing a boost::context and your boost:function instance. The context executes a trampoline function which will be invoked with the pointer to this object as argument. For more details look into boost.fiber.
Could you add an example using something else than a void(*)(void*) entry?
quick: struct X { boost::context ctx; X(); void execute(); }; void trampoline( void * vp) { X * x = static_cast< X * >( vp); x->execute(); } X::X() : ctx( boost::context::create( trampoline, this) ) {} Oliver