Today, i am working with python. I need write script to read one file, and get line by line, per line deliver one thread process ( total 10 threads). I want solution, so i chose working with thread and queue. In python, when procsess initializate, this process will be assigned with queue, and working with this queue. We will put data ( in this case is line) to queue. Process will read from queue, so, all processes can read one file, not overlap :D import threading import Queue #Number of threads n_thread = 5 #Create queue queue = Queue.Queue() class ThreadClass(threading.Thread): def __init__(self, queue): threading.Thread.__init__(self) #Assign thread working with queue self.queue = queue def run(self): while True: #Get from queue job host = self.queue.get() print self.getName() + ":" + host #signals to queue job is done self.queue.task_done() #Create number proce
Comments