Re: [Cppcms-users] Communication between synchronous and asynchronous applications
Brought to you by:
artyom-beilis
|
From: Artyom B. <art...@ya...> - 2013-11-22 14:05:16
|
Just create some thread safe object that can keep the data you need (i.e. member functions that access it protected with mutexes/rw-locks). Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ On Friday, November 22, 2013 8:12 AM, CN <cn...@fa...> wrote: Hello! > >Imagine I have both synchronous and asynchronous applications mounted: > >int main(int argc,char ** argv) >{ > try { > cppcms::service srv(argc,argv); > > srv.applications_pool().mount(cppcms::applications_factory<my_hello_world>()); > > booster::intrusive_ptr<chat> c=new chat(srv); > service.applications_pool().mount(c); > > srv.run(); > } > catch(std::exception const &e) { > std::cerr<<e.what()<<std::endl; > } >} > >Assume that >std::vector<cppcms::json::value> messages_; >in >http://cppcms.com/wikipp/en/page/cppcms_1x_chat_json_rpc >is public. > >If I understand the framework correctly, asynchronous applications run >in main thread. Therefore, asynchronous applications are appropriate >candidates to keep cross-application data, messages_ in our example, >that is to be shared by synchronous applications. > >I would like to know how to access messages_ kept in chat application >from my_hello_world. I have read both > >http://cppcms.com/wikipp/en/page/cppcms_1x_event_loop > >and > >http://cppcms.com/cppcms_ref/latest/classcppcms_1_1service.html#a29410e26d78c56c3f22389db5828cd0c > >but still have no idea how. Helps will be greatly appreciated. > >Regards, >CN > >-- >http://www.fastmail.fm - Or how I learned to stop worrying and > love email again > > >------------------------------------------------------------------------------ >Shape the Mobile Experience: Free Subscription >Software experts and developers: Be at the forefront of tech innovation. >Intel(R) Software Adrenaline delivers strategic insight and game-changing >conversations that shape the rapidly evolving mobile landscape. Sign up now. >http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |