[Apt-offline-devel] [SCM] Offline APT Package Manager branch, master, updated. 0.9.6-39-g07c765e

Ritesh Raj Sarraf rrs at researchut.com
Tue Mar 16 19:40:39 UTC 2010


The following commit has been merged in the master branch:
commit e09ead32d97dea08ce1b9ed5024992516121a98d
Author: Ritesh Raj Sarraf <rrs at researchut.com>
Date:   Fri Mar 12 19:00:30 2010 +0530

    some fixes to MyThread class

diff --git a/apt_offline_core/AptOfflineCoreLib.py b/apt_offline_core/AptOfflineCoreLib.py
index 93f81ea..f7ad38c 100644
--- a/apt_offline_core/AptOfflineCoreLib.py
+++ b/apt_offline_core/AptOfflineCoreLib.py
@@ -744,7 +744,7 @@ def fetcher( args ):
         responseQueue = Queue.Queue()
         
         
-        ConnectThread = AptOfflineLib.MyThread(requestQueue, responseQueue, abc, Int_NumOfThreads)
+        ConnectThread = AptOfflineLib.MyThread(abc, requestQueue, responseQueue, Int_NumOfThreads)
         
         ConnectThread.startThreads()
         
diff --git a/apt_offline_core/AptOfflineLib.py b/apt_offline_core/AptOfflineLib.py
index ad2a0b1..8c53812 100644
--- a/apt_offline_core/AptOfflineLib.py
+++ b/apt_offline_core/AptOfflineLib.py
@@ -527,7 +527,7 @@ class FileMgmt( object ):
 
 class MyThread( threading.Thread ):
         """My thread class"""
-        def __init__( self, requestQueue, responseQueue, WorkerFunction, NumOfThreads=1 ):
+        def __init__( self, WorkerFunction, requestQueue=None, responseQueue=None, NumOfThreads=1 ):
                 # Pool of NUMTHREADS Threads that run run().
                 self.requestQueue = requestQueue
                 self.responseQueue = responseQueue
@@ -536,7 +536,7 @@ class MyThread( threading.Thread ):
                 self.thread_pool = [
                        threading.Thread( 
                               target=self.run,
-                              args=( self.requestQueue, self.responseQueue )
+                              args=()
                               )
                        for i in range( self.threads )
                        ]
@@ -564,12 +564,19 @@ class MyThread( threading.Thread ):
                 for thread in self.thread_pool:
                         thread.join()
                         
-        def run( self, requestQueue, responseQueue):
+        def run( self, item=None):
                 while True:
-                        item = self.requestQueue.get()
+                        if self.requestQueue is not None:
+                                item = self.requestQueue.get()
+                                
                         if item is None:
                                 break
+                                
                         thread_name = threading.currentThread().getName()
-                        self.responseQueue.put( self.WorkerFunction( item, thread_name ) )
                         
-                        exit_status = self.responseQueue.get()
+                        if self.responseQueue is not None:
+                                self.responseQueue.put( self.WorkerFunction( item, thread_name ) )
+                                exit_status = self.responseQueue.get()
+                        else:
+                                self.WorkerFunction( item, thread_name )
+                                
\ No newline at end of file

-- 
Offline APT Package Manager



More information about the Apt-offline-devel mailing list