![]() |
Home | Libraries | People | FAQ | More |
// #include <boost/thread/with_lock_guard.hpp> namespace boost { template <class Lockable, class Function, class... Args> auto with_lock_guard(Lockable& m, Function&& func, Args&&... args) -> decltype(func(boost::forward<Args>(args)...)); }
template <class Lockable, class Function, class... Args> auto with_lock_guard( Lockable& m, Function&& func, Args&&... args ) -> decltype(func(boost::forward<Args>(args)...));
m
must be in unlocked
state
call func
in scope
locked by m
Result of func(args...)
call
Any exception thrown by the call to m.lock
and func(args...)
m
is in unlocked
state
Without c++11 variadic templates support number of arguments is limited
to 4
Without rvalue references support calling class method with boost::bind
must be const
For correct work with lambda macro BOOST_RESULT_OF_USE_DECLTYPE
may be needed to define