Chris M. Thomasson
2024-02-06 07:10:23 UTC
This is not giving me a warning, but an assertion. I am still wondering
why Bonita has to suppress all of those warnings wrt this thread ala MSVC:
https://groups.google.com/g/comp.lang.c++/c/pFsb3JI11-k
Here is some bugged code I just created, wrt MSVC version 17.8.5. No
warnings, but an assertion:
Loading Image...
code:
____________________________________
#include <iostream>
#include <functional>
#include <thread>
#include <mutex>
namespace ct
{
struct mutex_test
{
std::mutex m_mutex;
void
works()
{
m_mutex.lock();
m_mutex.unlock();
}
void
foobar()
{
m_mutex.lock();
//m_mutex.unlock(); YIKES!
}
};
}
int
main()
{
std::cout << "ct_threads... ;^)\n" << std::endl;
{
ct::mutex_test test;
test.works();
test.foobar(); // humm... Kabboom!
}
return 0;
}
____________________________________
Btw, I am going to port my new XCHG based code from Relacy race detector
into actual C++ code where we all can play with it. Getting to a point
where I need to use it for a project.
why Bonita has to suppress all of those warnings wrt this thread ala MSVC:
https://groups.google.com/g/comp.lang.c++/c/pFsb3JI11-k
Here is some bugged code I just created, wrt MSVC version 17.8.5. No
warnings, but an assertion:
Loading Image...
code:
____________________________________
#include <iostream>
#include <functional>
#include <thread>
#include <mutex>
namespace ct
{
struct mutex_test
{
std::mutex m_mutex;
void
works()
{
m_mutex.lock();
m_mutex.unlock();
}
void
foobar()
{
m_mutex.lock();
//m_mutex.unlock(); YIKES!
}
};
}
int
main()
{
std::cout << "ct_threads... ;^)\n" << std::endl;
{
ct::mutex_test test;
test.works();
test.foobar(); // humm... Kabboom!
}
return 0;
}
____________________________________
Btw, I am going to port my new XCHG based code from Relacy race detector
into actual C++ code where we all can play with it. Getting to a point
where I need to use it for a project.