[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Add documentation
Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria:/tmp/cvs-serv27381
Modified Files:
ThreadUtils.py
Log Message:
Add documentation
Index: ThreadUtils.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ThreadUtils.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- ThreadUtils.py 7 Feb 2005 06:18:40 -0000 1.10
+++ ThreadUtils.py 4 Jun 2005 13:54:14 -0000 1.11
@@ -124,7 +124,7 @@
#----------------------------------------------------------------------
class DummyLock:
- """DOCDOC"""
+ """Fake lock-like object to use when no locking is needed."""
def __init__(self):
pass
def acquire(self):
@@ -280,8 +280,8 @@
self.rwOK.release()
#----------------------------------------------------------------------
-# Processing threads
-#DOCDOC
+# Processing threads: used to make tasks happen in background.
+
#XXXX008 add tests for these.
class ProcessingThread(threading.Thread):
@@ -290,6 +290,7 @@
Currently used to process packets in the background."""
# Fields:
# mqueue: a ClearableQueue of callable objects.
+ # threadName: the name of this thread (used in log msgs)
class _Shutdown:
"""Callable that raises itself when called. Inserted into the
queue when it's time to shut down."""
@@ -303,9 +304,10 @@
self.threadName = name
def shutdown(self,flush=1):
- """DOCDOC"""
+ """Tells this thread to shut down once the current job is done."""
LOG.info("Telling %s to shut down.", self.threadName)
- if flush: self.mqueue.clear()
+ if flush:
+ self.mqueue.clear()
self.mqueue.put(ProcessingThread._Shutdown())
def addJob(self, job):
@@ -315,6 +317,7 @@
self.mqueue.put(job)
def run(self):
+ """Internal: main body of processing thread."""
try:
while 1:
job = self.mqueue.get()