From ffd39b030c31475e0d028280116770627048db0c Mon Sep 17 00:00:00 2001 From: Pepping <pepping> Date: Wed, 4 Jun 2014 11:02:57 +0000 Subject: [PATCH] - Added comments --- tools/oneclick/prestudy/multithreads.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/oneclick/prestudy/multithreads.py b/tools/oneclick/prestudy/multithreads.py index 12d85b8cde..46c1c743e7 100644 --- a/tools/oneclick/prestudy/multithreads.py +++ b/tools/oneclick/prestudy/multithreads.py @@ -55,6 +55,14 @@ class base_component(object): #'>' operator: Connect def __gt__(self, other): return self.__connect__(other) + + # The __connect__ method fills the out_q attribute. + # out_q is a 3-dimensional list with pointers to the write-side of the + # communication pipes: out_q[x][y][z], where + # x iterates over the fanout (the number of connected snk's). + # y iterates over the number of outputs. + # z indexes the write-side of the pipe and is always [1] + # def __connect__(self, other): if hasattr(other, 'in_q'): # Create a list for all outputs. @@ -68,9 +76,6 @@ class base_component(object): else: print 'Error: downstream component', other.name, 'does not have snk' - def run(self): - return None - # Components inheriting the base component class class blockGen(threading.Thread, base_component): @@ -116,7 +121,7 @@ class dataBuffer(threading.Thread, base_component): for j in xrange(self.nof_packets): for i in xrange(self.nof_inputs): data.append(self.in_q[i][0].recv()) - time.sleep(self.index) + time.sleep(self.index) # Added a sleep to avoid clashing of the print output. print self.name for i in data: print i -- GitLab