[pitivi: 7/94] Check that the thread class passed to threads.ThreadMaster.addThread subclasses Thread



commit 2e7fe17d77fb81e8d6812fe0364c64d1283652bd
Author: Alex BÄluÈ <alexandru balut gmail com>
Date:   Sun Aug 21 10:59:17 2011 +0200

    Check that the thread class passed to threads.ThreadMaster.addThread subclasses Thread

 pitivi/threads.py |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/pitivi/threads.py b/pitivi/threads.py
index 5b65b0b..6077018 100644
--- a/pitivi/threads.py
+++ b/pitivi/threads.py
@@ -38,8 +38,7 @@ class Thread(threading.Thread, Signallable, Loggable):
     """
 
     __signals__ = {
-        "done": None
-        }
+        "done": None}
 
     def __init__(self):
         threading.Thread.__init__(self)
@@ -77,7 +76,7 @@ class CallbackThread(Thread):
 
 class ThreadMaster(Loggable):
     """
-    Controls all thread existing in pitivi
+    Controls all the threads existing in Pitivi.
     """
 
     def __init__(self):
@@ -85,10 +84,8 @@ class ThreadMaster(Loggable):
         self.threads = []
 
     def addThread(self, threadclass, *args):
-        """ Start the given Thread """
-        # IDEA : We might need a limit of concurrent threads ?
-        # ... or some priorities ?
-        # FIXME : we should only accept subclasses of our Thread class
+        """ Instantiate the specified Thread class and start it. """
+        assert issubclass(threadclass, Thread)
         self.log("Adding thread of type %r", threadclass)
         thread = threadclass(*args)
         thread.connect("done", self._threadDoneCb)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]