Menu

[r2007]: / framework / trunk / tests / loadable_storage_test.cpp  Maximize  Restore  History

Download this file

32 lines (27 with data), 646 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cppcms/service.h>
#include <booster/aio/deadline_timer.h>
#include <iostream>
struct stopper {
cppcms::service *srv;
stopper(cppcms::service *s) : srv(s) {}
void operator()(booster::system::error_code const &) const
{
srv->shutdown();
}
};
int main(int argc,char **argv)
{
try {
cppcms::service srv(argc,argv);
booster::aio::deadline_timer timer(srv.get_io_service());
timer.expires_from_now(booster::ptime::seconds(1));
timer.async_wait(stopper(&srv));
srv.run();
}
catch(std::exception const &e) {
std::cerr<< "Failed: " << e.what() << std::endl;
return 1;
}
std::cout << "Ok" << std::endl;
return 0;
}
MongoDB Logo MongoDB