Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] Using io_service::poll() without pthread locking and unlocking
From: 谢任中 (joshchia_at_[hidden])
Date: 2015-10-30 23:06:15


I just tried BOOST_ASIO_DISABLE_THREADS and it worked.

On Thu, Oct 29, 2015 at 9:46 PM, <stefan.naewe_at_[hidden]> wrote:

> Am 29.10.2015 um 11:10 schrieb ☂Josh Chia (谢任中):
> > I'm using boost::asio to do some TCP socket communication from a
> > single-threaded program. The program performs asynchronous reads and
> > writes and keeps calling io_service::poll() from a busy loop.
> >
> > I noticed from callgrind profiling that a significant portion of time
> > is spent on pthread locking and unlocking from io_service::poll(). If
> > I can get rid of the lock operations, the performance will improve
> > significantly. Is there a way to get io_service to not use locks
> > other than hacking the source code? It's a single-threaded
> > application so the locking is unnecessary.
> >
> > The main reason I'm using asio is for the abstraction that allows me
> > to write clean, simple, code, and hope I don't have to give up
> > performance for simplicity.
> >
> > Josh
>
> Did you try
>
> #define BOOST_ASIO_DISABLE_THREADS
>
> ??
>
> Stefan
> --
> ----------------------------------------------------------------
> /dev/random says: A harp is a nude piano.
> python -c "print
> '73746566616e2e6e616577654061746c61732d656c656b74726f6e696b2e636f6d'.decode('hex')"
> GPG Key fingerprint = 2DF5 E01B 09C3 7501 BCA9 9666 829B 49C5 9221 27AF
> _______________________________________________
> 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