Re: [Cppcms-users] cppcms hangs if cppcms::application ctor throws exception
Brought to you by:
artyom-beilis
|
From: Shiv S. D. <shi...@gm...> - 2013-11-29 10:09:37
|
Tested with GCC 4.7.0 GNU/Linux Mint 15 CppCMS 1.0.4 seems to work
fine as it prints "Exception" on console and program terminates.
On Fri, Nov 29, 2013 at 3:32 PM, Karsten Ahnert <
kar...@go...> wrote:
> Hi,
>
> cppcms hangs if the constructor of cppcms::application and derived class
> throw, see the code below. Any ideas how to fix this?
>
>
>
>
> #include <cppcms/applications_pool.h>
> #include <cppcms/service.h>
> #include <cppcms/http_response.h>
> #include <cppcms/application.h>
>
> #include <iostream>
> #include <stdexcept>
>
> using namespace std;
>
> class my_app : public cppcms::application
> {
> public:
>
> my_app( cppcms::service& srv )
> : cppcms::application( srv )
> {
> throw std::runtime_error( "Exception" );
> }
>
> virtual void main(std::string url)
> {
> cout << "Hello world!" << endl;
>
> response().out() <<
> "<html>\n"
> "<body>\n"
> " <h1>Hello World</h1>\n"
> "</body>\n"
> "</html>\n";
> }
> };
>
>
> int main( int argc , char **argv )
> {
> try
> {
> cppcms::service app( argc , argv );
> app.applications_pool().mount( cppcms::applications_factory<
> my_app >() );
> app.run();
> }
> catch( std::exception const &e )
> {
> std::cerr << e.what() << std::endl;
> }
>
> return 0;
> }
>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics
> Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
--
Respect,
Shiv Shankar Dayal
|