convert from Glib:: to Glib::Threads for all thread-related API
[ardour.git] / libs / ardour / ardour / session_route.h
index afe78b394e39efcafba0cf1b0893a1d7c2431c18..19d8614d1b40221fe4bad6e470f240634ff58a67 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2000 Paul Davis 
+    Copyright (C) 2000 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
@@ -15,7 +15,6 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id$
 */
 
 #ifndef __ardour_session_route_h__
 
 #include <iostream>
 
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
 
-#include <ardour/session.h>
-#include <ardour/route.h>
+#include "ardour/session.h"
+#include "ardour/route.h"
 
 namespace ARDOUR {
 
-template<class T> void 
+template<class T> void
 Session::foreach_route (T *obj, void (T::*func)(Route&))
 {
-       RouteList public_order;
-
-       {
-               Glib::RWLock::ReaderLock lm (route_lock);
-               public_order = routes;
-       }
-
+       boost::shared_ptr<RouteList> r = routes.reader();
+       RouteList public_order (*r);
        RoutePublicOrderSorter cmp;
+
        public_order.sort (cmp);
 
        for (RouteList::iterator i = public_order.begin(); i != public_order.end(); i++) {
@@ -48,17 +43,13 @@ Session::foreach_route (T *obj, void (T::*func)(Route&))
        }
 }
 
-template<class T> void 
-Session::foreach_route (T *obj, void (T::*func)(Route*))
+template<class T> void
+Session::foreach_route (T *obj, void (T::*func)(boost::shared_ptr<Route>))
 {
-       RouteList public_order;
-
-       {
-               Glib::RWLock::ReaderLock lm (route_lock);
-               public_order = routes;
-       }
-
+       boost::shared_ptr<RouteList> r = routes.reader();
+       RouteList public_order (*r);
        RoutePublicOrderSorter cmp;
+
        public_order.sort (cmp);
 
        for (RouteList::iterator i = public_order.begin(); i != public_order.end(); i++) {
@@ -66,18 +57,13 @@ Session::foreach_route (T *obj, void (T::*func)(Route*))
        }
 }
 
-
-template<class T, class A> void 
+template<class T, class A> void
 Session::foreach_route (T *obj, void (T::*func)(Route&, A), A arg1)
 {
-       RouteList public_order;
-
-       {
-               Glib::RWLock::ReaderLock lm (route_lock);
-               public_order = routes;
-       }
-
+       boost::shared_ptr<RouteList> r = routes.reader();
+       RouteList public_order (*r);
        RoutePublicOrderSorter cmp;
+
        public_order.sort (cmp);
 
        for (RouteList::iterator i = public_order.begin(); i != public_order.end(); i++) {