"Peter Dimov" <[EMAIL PROTECTED]> writes: >>> except that the async_call doesn't need to know about Executors. >> >> ...and that you don't need a special syntax to get the result out that >> isn't compatible with functional programming. If you want to pass a >> function object off from the above, you need something like: >> >> bind(&async_call<int>::result, async_call<int>(bind(g, 1, 2))) > > Hmm. Actually I'll need a similar three-liner: > > async_call<int> f( bind(g, 1, 2) ); > // execute f using whatever Executor is appropriate > // pass bind(&async_call<int>::result, &f) to whoever is interested
A little bit worse, you gotta admit. > Synchronous RPC calls notwithstanding, the point of the async_call is that > the creation+execution (lines 1-2) are performed well in advance so that the > background thread has time to run. It doesn't make sense to construct and > execute an async_call if the very next thing is calling result(). So in a > typical scenario there will be other code between lines 2 and 3. I agree, but I'm not sure what difference it makes. > The bind() can be syntax-sugared, of course. :-) I think some useful syntax-sugaring is what I'm trying to push for ;-) >>>> int r = async_call<int>(create_thread(), bind(g, 1, 2)); >>>> >>>> int r = async(boost::thread(), g, 1, 2); >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>>> >>>> int r = async_call<int>(rpc(some_machine), bind(g,1,2)); >>>> >>>> int r = async_call<int>(my_message_queue, bind(g,1,2)); >>> >>> All of these are possible with helper functions (and the <int> could >>> be made optional.) >> >> Yup, note the line in the middle. > > The line in the middle won't work, actually, but that's another story. > boost::thread() creates a "handle" to the current thread. ;-) Score another > one for defining concepts before using them. Oh, I'm not up on the new interface. How are we going to create a new thread? -- Dave Abrahams Boost Consulting www.boost-consulting.com _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost