Boost logo

Boost Users :

Subject: [Boost-users] Multi-threaded socket server (1 thread per core)
From: Alex Black (alex_at_[hidden])
Date: 2009-07-22 16:32:55


Is Http Server 3 a good approach for this?

http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/examples.html#boost_asio.examples.http_server_3

I've got a server, that listens on a socket. It receives requests, and does CPU-bound work, then writes out a response. So I'd like it to handle N requests at a time, where N is the number of cores.

HTTP Server 3 looks like it does this, but questions:
- is this the best approach?
- what (practically speaking) will happen to HTTP Server 3 if all of its threads are busy processing requests, and say 10 requests arrive. Will they fail? Will the O/S queue them up?

- Alex

> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of
> Pavel Shevaev
> Sent: Wednesday, July 22, 2009 3:44 PM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] weak_ptr and thread safety
>
> >   // before A and B
> >   shared_ptr<X> p( new X );
> >   weak_ptr<X> wp( p );
> >
> >   // A
> >   shared_ptr<X> p2 = wp.lock();
> >
> >   // B
> >   p.reset();
> >
> > is safe (A reads wp, B writes p).
>
> This is my case, thanks for the clarification(what a relief, btw).
> Hm...guess at least it's not what causing my app to seg.fault :)
>
> --
> Best regards, Pavel
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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