Re: [Cppcms-users] Document regarding input content filtering
Brought to you by:
artyom-beilis
From: Artyom B. <art...@gm...> - 2016-04-13 10:24:16
|
Ok got your problem... See, resubmitting the context is to take a context from an application in one pool and move to another, for example to do filter in async application and move the context to sync application for processing. The idea is following: You create one pool - lets say synchronous and keep a week_ptr on it. Than you create a new asynchronous filtering pool and pass it to the filtering pool: shared_ptr processor = cppcms::create_pool<myprcessor>(); srv.applications_pool().mount(processor,...) weak_ptr weak_pool = processor; srv.applications_pool().mount(cppcms::create_pool<myfilter>(weak_pool),asynchronous|filter) So the weak reference to the pool is reference to another pool not my own pool. The code I shown is how to get __my own__ pool rather than another one because without a tutorial context you wanted to get your own pool. In general you don't resubmit context to yourself > pool_ptr pool = get_pool().lock(); /* note here! */ > if(pool) { > shared_ptr<context> ctx = release_context(); > // now this context goes to another > // application to be run. > ctx->submit_to_pool(pool,path); > > } Would create an infinite loop. So if you want the reference to the pool you need to keep one from the beginning. Artyom |