add syntax and scaffolding for MIDI binding maps to refer to selected tracks/busses.
[ardour.git] / libs / pbd / pbd / stacktrace.h
index 0a349dcaebbcdb67c4c99abbe3c3e9525eb39d9a..99fc9d5c574f742e400532f8fb8144928fee9b2c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2000-2007 Paul Davis 
+    Copyright (C) 2000-2007 Paul Davis
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 #ifndef __libpbd_stacktrace_h__
 #define __libpbd_stacktrace_h__
 
+#ifdef HAVE_WAFBUILD
+#include "libpbd-config.h"
+#endif
+
 #include <iostream>
 #include <ostream>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
 #include <list>
 
-namespace PBD {
-       void stacktrace (std::ostream& out, int levels = 0);
-       void trace_twb();
-
 #ifdef HAVE_EXECINFO
 #include <execinfo.h>
-#include <stdlib.h>
+#include <cstdlib>
 #endif
 
+#include "pbd/libpbd_visibility.h"
+
+
+namespace PBD {
+
+       LIBPBD_API void stacktrace (std::ostream& out, int levels = 0);
+       LIBPBD_API void trace_twb();
+
 template<typename T>
-class thing_with_backtrace 
+class /*LIBPBD_API*/ thing_with_backtrace
 {
   public:
     thing_with_backtrace () {
@@ -43,10 +51,10 @@ class thing_with_backtrace
 #ifdef HAVE_EXECINFO
            allocation_backtrace = new void*[50];
            allocation_backtrace_size = backtrace (allocation_backtrace, 50);
-#else 
+#else
            allocation_backtrace_size = 0;
 #endif
-           Glib::Mutex::Lock lm (all_mutex);
+           Glib::Threads::Mutex::Lock lm (all_mutex);
            all.push_back (this);
     }
 
@@ -55,18 +63,18 @@ class thing_with_backtrace
 #ifdef HAVE_EXECINFO
            allocation_backtrace = new void*[50];
            allocation_backtrace_size = backtrace (allocation_backtrace, 50);
-#else 
+#else
            allocation_backtrace_size = 0;
 #endif
-           Glib::Mutex::Lock lm (all_mutex);
+           Glib::Threads::Mutex::Lock lm (all_mutex);
            all.push_back (this);
     }
 
-    ~thing_with_backtrace() { 
+    ~thing_with_backtrace() {
            if (allocation_backtrace_size) {
                    delete [] allocation_backtrace;
            }
-           Glib::Mutex::Lock lm (all_mutex);
+           Glib::Threads::Mutex::Lock lm (all_mutex);
            all.remove (this);
     }
 
@@ -81,9 +89,9 @@ class thing_with_backtrace
            for (x = all.begin(); x != all.end(); ++x) {
                    char **strings;
                    size_t i;
-                   
+
                    strings = backtrace_symbols ((*x)->allocation_backtrace, (*x)->allocation_backtrace_size);
-                   
+
                    if (strings) {
                            stream << "--- ALLOCATED SHARED_PTR @ " << (*x) << std::endl;
                            for (i = 0; i < (*x)->allocation_backtrace_size && i < 50U; i++) {
@@ -101,14 +109,12 @@ private:
     void** allocation_backtrace;
     int allocation_backtrace_size;
     static std::list<thing_with_backtrace<T>* > all;
-    static Glib::StaticMutex all_mutex;
+    static Glib::Threads::Mutex all_mutex;
 };
 
-template<typename T> std::list<PBD::thing_with_backtrace<T> *> PBD::thing_with_backtrace<T>::all;
-template<typename T> Glib::StaticMutex PBD::thing_with_backtrace<T>::all_mutex = GLIBMM_STATIC_MUTEX_INIT;
+template<typename T> /*LIBPBD_API*/ std::list<PBD::thing_with_backtrace<T> *> PBD::thing_with_backtrace<T>::all;
+template<typename T> /*LIBPBD_API*/ Glib::Threads::Mutex PBD::thing_with_backtrace<T>::all_mutex;
 
 } // namespace PBD
 
-
-
 #endif /* __libpbd_stacktrace_h__ */