Re: [boost] [context] Implementation comments

Why is boost::thread implemented with move-semantics?
Boost.Context is much more low level than Boost.Thread. why? thread and context are resources - I don't see context more low level than thread
Hold on. I understand that that you are saying that context is the same level as thread. On the other hand in the reply to my question (about using boost::function) you said
boost.context is intended to be the basis of such things like coroutines (see boost.coroutine) and fibers (see boost.fiber).
Which somehow implied that Context is lower-level than Coroutine or Fiber. If you really treat Context the same level as Thread, I would suggest passing function<void()> as trampoline function. If you can afford using pimpl, you can easily change function<void()> to void(*)(void*) and void* parameters: void call( void* arg) { auto ptr = static_cast< function<void()>* >( arg ); ptr->operator(); } function<void()> trampoline = ...; context_impl( call, &trampoline ); Using function<void()> makes it easier to understand for thread users and makes the interface similar to thread, task, etc... Regards, &rzej

so what? is it appropriate that boost::context has move semantics or not? what I tried to explain is, that boost::context can be tracked as a resource as boost::thread. -------- Original-Nachricht --------
Datum: Wed, 19 Jan 2011 12:40:20 +0100 Von: Andrzej Krzemienski <akrzemi1@gmail.com> An: boost@lists.boost.org Betreff: Re: [boost] [context] Implementation comments
Why is boost::thread implemented with move-semantics?
Boost.Context is much more low level than Boost.Thread. why? thread and context are resources - I don't see context more low level than thread
Hold on. I understand that that you are saying that context is the same level as thread. On the other hand in the reply to my question (about using boost::function) you said
boost.context is intended to be the basis of such things like coroutines (see boost.coroutine) and fibers (see boost.fiber).
Which somehow implied that Context is lower-level than Coroutine or Fiber. If you really treat Context the same level as Thread, I would suggest passing function<void()> as trampoline function. If you can afford using pimpl, you can easily change function<void()> to void(*)(void*) and void* parameters:
void call( void* arg) { auto ptr = static_cast< function<void()>* >( arg ); ptr->operator(); }
function<void()> trampoline = ...; context_impl( call, &trampoline );
Using function<void()> makes it easier to understand for thread users and makes the interface similar to thread, task, etc...
Regards, &rzej _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl

Am 19.01.2011 12:40, schrieb Andrzej Krzemienski:
Which somehow implied that Context is lower-level than Coroutine or Fiber. If you really treat Context the same level as Thread, I would suggest passing function<void()> as trampoline function. If you can afford using pimpl, you can easily change function<void()> to void(*)(void*) and void* parameters:
void call( void* arg) { auto ptr = static_cast< function<void()>*>( arg ); ptr->operator(); }
function<void()> trampoline = ...; context_impl( call,&trampoline );
Using function<void()> makes it easier to understand for thread users and makes the interface similar to thread, task, etc...
It make the implementation in assembler much more complicated (call C++ conventions in assembler). so long, Oliver
participants (2)
-
Andrzej Krzemienski
-
Oliver Kowalke