About std::mutex exception, In the destructor

0
#include <mutex>

class CTest 
{
public:
    ~CTest()
    {
        std::lock_guard<std::mutex> lock(mutex_); //here
    }
private:
    std::mutex mutex_;
};

CTest TT;

int main(void)
{
    while (1)
    {

    }

    system("pause");
    return 0;
}

When I run it, I choose to close the console window, causing std::mutex to throw an exception.

0xC000000D: An invalid parameter was passed to a service or function.

environment: msvc 2013 debug x64

Please advise. tks.

c++
asked on Stack Overflow Jul 27, 2020 by Joe VVV • edited Jul 27, 2020 by (unknown user)

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0