Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7422: condition_variable performance regression
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-09-26 19:05:06
#7422: condition_variable performance regression
------------------------------------------+---------------------------------
Reporter: maxim.yegorushkin@⦠| Owner: anthonyw
Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
Version: Boost 1.51.0 | Severity: Regression
Resolution: | Keywords: condition_variable
------------------------------------------+---------------------------------
Comment (by viboes):
Replying to [ticket:7422 maxim.yegorushkin@â¦]:
> In boost versions prior to 1.45 condition_variable was a zero-overhead
thin wrapper over pthread_cond_t.
>
> In version 1.45 an internal mutex was added to condition_variable to
improve thread cancellation support as described elsewhere (can't add the
link to gmane archive because Trac thinks it's spam).
>
> Since version 1.45 calling condition_variable::wait*() and
condition_variable::notify*() lock the internal mutex. Doing so causes
performance regressions for latency sensitive applications that don't use
thread cancellation. To put it in other words, condition_variable was
essentially turned into condition_variable_any.
>
> Could the old version of condition_variable be added back please?
As Anthony explained in the link you mention, we can not do that without
breaking existing code. I don't know if defining an additional
basic_condition_variable will respond to you expectations.
In any case, I don't see as a bug, except if you can find in the
documentation a reference to the zero-overhead.
> A good idea seems to be requiring a macro, for example
BOOST_THREADS_REQUIRE_THREAD_CANCELLATION, to be defined for
condition_variable to include the internal mutex or be an alias for
condition_variable_any. A call to thread::interrupt() would fail at
compile time if BOOST_THREADS_REQUIRE_THREAD_CANCELLATION is not defined.
Things may get more complicated if any compiled boost libraries use
condition_variable though.
Well this is a different feature that should merit a specific ticket.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7422#comment:1> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC