Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Thread] Multithreaded Multithreaded Server
From: Igor R (boost.lists_at_[hidden])
Date: 2011-04-10 15:43:23

> I'm trying to write a multithreaded multithreaded server (two multithreaded
> operations): ideally, there should be a single process, containing at least
> two threads.  The first thread handles various tasks (and can start other
> threads to help it as well).  The other thread waits for incoming
> connections, and adds a new thread for each one:

So, for 1000 connection you end up with 1000 threads, don't you?

> Unfortunately, when a connection is found, Thread 1 stops.  I can only
> attribute this to a lock boost::asio::io_service puts, although I have no idea.

io_service::run() blocks the thread. You can think of it like a
"message loop" -- it runs as long as io_service has completion
handlers to dispatch.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at