C++/CLI is known to block the mutex header when a project is compiled using the -clr:pure or clr flag. The error is reported here https://social.msdn.microsoft.com/Forums/vstudio/en-US/d4d082ff-ce43-478d-8386-0effed04b108/ccli-and-stdmutex?forum=vclanguage
The recommended solution seems to be to use the pimpI
pattern. See here
Turn off clr option for header file with std::mutex
The problem I see is when using other std
functions.
For example consider the std::condition_variable
mutexPimpI _mut;
std::unique_lock<mutexPimpI> lk(_mut); //Fine std::unique_lock is templated.
std::condition_variable _gate1;
_gate1.wait(lk); //Error wait expects std::unique_lock<std::mutex> as argument
Is there any easy way to resolve / work around this problem?