Boost logo

Boost Users :

Subject: Re: [Boost-users] running a server "in background mode" ??
From: Igor R (boost.lists_at_[hidden])
Date: 2009-11-10 07:29:57


>     boost::asio::io_service io_service;
>     tcp_server server(io_service);
>     io_service.run();

io_service::run() does not return until there's no work for io_service.
But you can run io_service in another thread:

new boost::thread(&asio::io_service::run, &io_service); // note that
io_service object can't be local here, as it must outlive the thread!


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net