mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-09 05:10:23 +00:00
FreeBSD support, patch 5
drd and helgrind tests
This commit is contained in:
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user