Angus Leeming <[EMAIL PROTECTED]> writes: | On Friday 25 October 2002 8:59 am, Lars Gullik Bjønnes wrote: | > Angus Leeming <[EMAIL PROTECTED]> writes: | > | John, | > | | > | attached is some rough and ready, proof of principle code | > | that appears to do the job. | > | | > | To generate an autosave type | > | buffer-auto-save | > | in the minibuffer. You should get "Autosaving Buffer" | > | printed to the console. If you have the Child Processes | > | dialog open, you should also get something flashing up | > | there, indicating that the process is being stored by the | > | ForkedController as we desire. | > | | > | I certainly can't generate zombies, but maybe you'll have a | > | go too? | > | > Ok, Good work. | > | > ...but I am not sure that I agree with the interface. | > Especially the ForkedBase(?). | > | > I was imagining some interface like: | > | > processController.call(boost::bind(autoSave, &buffer), | > Proc::background); | > | > | > which would fork, and run the function object in the newly | > created process. | | I tried that. The problem is that we'd need | | template<typename Func1, typename Arg1> | processController::call(Func1 & func, Arg1 const & arg1); | | template<typename Func2, typename Arg1, typename Arg2> | processController::call(Func1 & func, Arg1 const & arg1, Arg2 const & arg2); | | etc.
No you wouldn't. All that would be hidden with the boost::function functor. processController::call(boost::function0<void> func); should be enough. and then boost::bind would be used to reduce whatever function to that signature. boost::function<void> func = boost::bind(autoSave, arg, arg ,arg); func(); // call without args, they are already bound. | Feel free to prove me wrong here, but my proposed solution is | little more than rearranging code that we know works. We are in | bug-fixing mode, remember. as such it is quite ok, but there is a bit more coupling now, isn't it? -- Lgb