Revision: 40576
          http://brlcad.svn.sourceforge.net/brlcad/?rev=40576&view=rev
Author:   davidloman
Date:     2010-09-15 14:59:28 +0000 (Wed, 15 Sep 2010)

Log Message:
-----------
Put in basic GSThread management to allow for monitoring all running threads 
from a central location.  Needs a lot of work still.

Modified Paths:
--------------
    rt^3/trunk/include/GSThread.h
    rt^3/trunk/src/utility/GSThread.cxx

Modified: rt^3/trunk/include/GSThread.h
===================================================================
--- rt^3/trunk/include/GSThread.h       2010-09-15 14:35:00 UTC (rev 40575)
+++ rt^3/trunk/include/GSThread.h       2010-09-15 14:59:28 UTC (rev 40576)
@@ -39,8 +39,13 @@
   static void msleep (unsigned long msecs);
   static void usleep (unsigned long usecs);
 
-private:
+protected:
 
+  //For thread management
+  static QList<GSThread*> threads;
+  static void addThread(GSThread* thread);
+  static void remThread(GSThread* thread);
+
 };
 
 #endif /* __GSTHREAD_H__ */

Modified: rt^3/trunk/src/utility/GSThread.cxx
===================================================================
--- rt^3/trunk/src/utility/GSThread.cxx 2010-09-15 14:35:00 UTC (rev 40575)
+++ rt^3/trunk/src/utility/GSThread.cxx 2010-09-15 14:59:28 UTC (rev 40576)
@@ -25,6 +25,8 @@
 
 #include "GSThread.h"
 
+QList<GSThread*> threads();
+
 GSThread::GSThread()
 {
 }
@@ -51,6 +53,31 @@
   QThread::usleep(usecs);
 }
 
+
+void
+GSThread::addThread(GSThread* thread)
+{
+  bool exists = GSThread::threads.contains(thread);
+
+  if (!exists) {
+    GSThread::threads.append(thread);
+  } else {
+    //Todo possible warning for duplicate threads in the list?
+  }
+}
+
+void
+GSThread::remThread(GSThread* thread)
+{
+  bool exists = GSThread::threads.contains(thread);
+
+  if (exists) {
+    GSThread::threads.removeAll(thread);
+  } else {
+    //Todo possible warning for attempting to remove a thread not in the list?
+  }
+}
+
 // Local Variables:
 // tab-width: 8
 // mode: C++


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to