Commit cbb269b6 authored by Christophe Gonzales's avatar Christophe Gonzales

adding parallelism support for aGrUM debugging skip ci

parent 9225184f
Pipeline #23226391 canceled with stages
in 1 minute 48 seconds
......@@ -32,6 +32,7 @@
#include <sstream>
#include <string>
#include <vector>
#include <mutex>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
......@@ -44,6 +45,8 @@ namespace gum {
namespace __debug__ {
typedef std::map< std::string, int > DEBUG_MAP;
static std::mutex debug_mutex;
// this static hashtable only on debug mode.
static DEBUG_MAP& __sizeof() {
// This function is not thread-safe ! (but only in debug mode)
......@@ -88,10 +91,11 @@ namespace gum {
const char* zeMsg,
const void* zePtr,
int zeSize) {
debug_mutex.lock ();
__show_trace(zeKey, zeFile, zeLine, zeMsg, zePtr);
__creation()[zeKey]++;
__sizeof()[zeKey] = zeSize;
debug_mutex.unlock ();
}
// to handle static element of agrum library
......@@ -100,8 +104,10 @@ namespace gum {
long zeLine,
const char* zeMsg,
const void* zePtr) {
debug_mutex.lock ();
__show_trace(zeKey, zeFile, zeLine, zeMsg, zePtr);
__creation()[zeKey]--;
debug_mutex.unlock ();
}
void __inc_deletion(const char* zeKey,
......@@ -109,8 +115,10 @@ namespace gum {
long zeLine,
const char* zeMsg,
const void* zePtr) {
debug_mutex.lock ();
__show_trace(zeKey, zeFile, zeLine, zeMsg, zePtr);
__deletion()[zeKey]++;
debug_mutex.unlock ();
}
void __dumpObjects() {
......
......@@ -466,12 +466,12 @@ namespace gum {
try {
allocator2.construct(__end_safe, *this);
} catch (...) {
allocator1.destroy(__end);
allocator1.deallocate(__end, 1);
allocator2.deallocate(__end_safe, 1);
throw;
}
} catch (...) {
allocator2.deallocate(__end_safe, 1);
} catch ( ... ) {
allocator1.destroy(__end);
allocator1.deallocate(__end, 1);
throw;
}
}
......
......@@ -806,7 +806,7 @@ namespace gum_tests {
TS_ASSERT(nb == 1);
}
void testBugDoumenc() {
void test_BugDoumenc() {
gum::BayesNet< double > templ;
std::vector< std::string > varBool{"S",
"DEP",
......@@ -879,7 +879,7 @@ namespace gum_tests {
}
void testBugDoumencWithInt() {
void test_BugDoumencWithInt() {
gum::BayesNet< double > templ;
std::vector< std::string > varBool{"S",
"DEP",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment