13 #include <boost/asio.hpp>
14 #include <boost/thread.hpp>
15 #include <boost/bind.hpp>
16 #include <boost/lexical_cast.hpp>
25 int main(
int argc,
char* argv[]) {
31 std::cerr <<
"Usage: airinvServer <address> <port> <threads> <doc_root>"
33 std::cerr <<
" For IPv4, try:" << std::endl;
34 std::cerr <<
" receiver 0.0.0.0 80 1 ." << std::endl;
35 std::cerr <<
" For IPv6, try:" << std::endl;
36 std::cerr <<
" receiver 0::0 80 1 ." << std::endl;
42 sigfillset (&new_mask);
44 pthread_sigmask (SIG_BLOCK, &new_mask, &old_mask);
47 std::size_t num_threads = boost::lexical_cast<std::size_t>(argv[3]);
52 pthread_sigmask (SIG_SETMASK, &old_mask, 0);
56 sigemptyset (&wait_mask);
57 sigaddset (&wait_mask, SIGINT);
58 sigaddset (&wait_mask, SIGQUIT);
59 sigaddset (&wait_mask, SIGTERM);
60 pthread_sigmask (SIG_BLOCK, &wait_mask, 0);
62 sigwait (&wait_mask, &sig);
68 }
catch (std::exception& e) {
69 std::cerr <<
"exception: " << e.what() <<
"\n";
75 #endif // !defined(_WIN32)