forked from artyom-beilis/cppcms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloadable_storage_test.cpp
More file actions
38 lines (34 loc) · 1.09 KB
/
loadable_storage_test.cpp
File metadata and controls
38 lines (34 loc) · 1.09 KB
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
32
33
34
35
36
37
38
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
//
// See accompanying file COPYING.TXT file for licensing details.
//
///////////////////////////////////////////////////////////////////////////////
#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;
}