I see an error in the code below.
recursive_mutex m_RecurMutex; condition_variable cond; unique_lock<recursive_mutex> lock(m_RecurMutex); cond.wait(lock); // Error Here.
What is the reason for this error?
I assume the error
mutex.cc: In function ‘int main()’: mutex.cc:9: error: no matching function for call to ‘boost::condition_variable::wait(boost::unique_lock<boost::recursive_mutex>&)’ /opt/local/include/boost/thread/pthread/condition_variable.hpp:17: note: candidates are: void boost::condition_variable::wait(boost::unique_lock<boost::mutex>&) i
If not, please correct me. The documentation shows what boost::condition_variable::locktakes boost::unique_lock<boost::mutex>as an argument, and not boost::unique_lock<boost::recursive_mutex>as in your example.
boost::condition_variable::lock
boost::unique_lock<boost::mutex>
boost::unique_lock<boost::recursive_mutex>
Instead, you should use condition_variable_any, the semantics of this version are the same, but it allows you to use all types of locks. However, regular condition_variableis considered potentially faster.
condition_variable_any
condition_variable
Source: https://habr.com/ru/post/1768753/More articles:jquery - jqueryКак вернуть eval (код) и вернуть объект с помощью JavaScript? - javascriptProblems with Package Manager Console - .netAre Linux timezone files always in / usr / share / zoneinfo? - timezonePHP replaces variables in a Word document - variablesZend Paginator отображает неправильный счет страницы, когда запрос имеет "отличную" - phpWhy am I getting a segmentation error? - cUNIX: Strange output if smaller - unixhow to reset multiple LINQPAD levels - .netWhen a module is imported into a Ruby class, is it similar to composition? - ruby | fooobar.comAll Articles