FreeBSD support, patch 5

drd and helgrind tests
This commit is contained in:
Paul Floyd
2021-10-07 21:33:45 +02:00
parent f22758d6da
commit 85bbe2853e
67 changed files with 1987 additions and 188 deletions

View File

@@ -15,9 +15,34 @@
#include <string>
#include <sstream>
#include <list>
#if defined(__FreeBSD__)
#include <mutex>
#endif
using namespace std;
#if defined(__FreeBSD__)
std::mutex g_mutex;
// according to this
// https://stackoverflow.com/questions/4057319/is-setlocale-thread-safe-function
// setlocale is not thread safe, and indeed on FreeBSD
// a load of errors are generated if this is not guarded
void setlocale_wrapper()
{
const std::lock_guard<std::mutex> lock(g_mutex);
setlocale(LC_ALL, "English");
}
#else
void setlocale_wrapper()
{
setlocale(LC_ALL, "English");
}
#endif
class SubTest {
public:
SubTest() {
@@ -41,7 +66,7 @@ class Test {
public:
void setUp() {
subTest = new SubTest();
setlocale(LC_ALL, "English");
setlocale_wrapper();
}
void tearDown() {
delete subTest; }