This is a similar source uploaded only yesterday, but to help you solve some problems.
It is a bit of a shame to ask one more question about this problem: (
But even though I have thought that what is the problem all day, then I So,
It feels good and does work, but the problem is that some threads do not end itself for a long time.
I waited 10 minutes but the 6 threads are still alive.
This is the biggest secret Import import thradding import multi processing df finder (path, q, done):
Would you teach me what is wrong with it? Root, Files in DIERS, OS Walk (Unicode (path)): For DIIRs: For DIORs: If target in DIARNL.: Q.put (os.path.join (root, dirname)) for files in the file: if Target in name. (): Q.put (os.path.join (root, name)) # Print "Good bye", threading. Current_thread () #print threading.active_count () done.p (1) def pre (Q, done, worker_count): total = 0 while 1: try: except done: done_get_nowait (): pass: try total + = 1: excluding tmp = q.get (timeout = 1): second : Print tmp if total == worker_count: break if __name__ == "__ main__": result = multiprocessing. Question () done = Multiprocessing. Question () Route, DIRS, File = Oswask (U "C: \\"). For dirname in dinname: (if) target in dirname.lower (): q.put (os.path.join (root, dirname)) for name in file: if target in name.lower (): q For I in Extraz (Thanam). (OSpath.Joint (root, name)) thnum = len (dirs) target = raw_input ("whatever you want \ n"): full_path = os.path.join (root, Dirs [i]) t = threading. Thread (target = finder, args = (full_path, result, done,)) t. Start () P = Multiprocessing. Process (target = printers, args = (results, done, thumbs),) P.start () p.join ()
Comments
Post a Comment