|
Boost Users : |
Subject: Re: [Boost-users] [asio] Using io_service::poll() without pthread locking and unlocking
From: stefan.naewe_at_[hidden]
Date: 2015-10-29 09:46:58
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 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