thread stomp?

pyn3wb pyn3wb at pyn3wb.com
Mon May 12 16:00:52 EDT 2008


class1 (threading.Thread):
	def __init__(self, dir):
		self.dir = dir
		threading.Thread.__init__(self)
	
	def run(self):
		do stuff in dir here...

class2 (threading.Thread):
	def __init__(self, dir, dir2):
		self.file = g
		self.dir2 = dir2
		threading.Thread.__init__(self)

	def run(self):
		do stuff in dir here...
		output to dir2

class main
	for i in dircache.listdir(dir):
		//run over files
		class1(dir).start()

	for j in dircache.listdir(dir2):
		//run over files, dependent on stuff in dir
		class2(dir2).start()

think just using the loops above enough to prevent class2 threads from 
starting before class1 threads done

not true

class2 threads seems to start prior to class1 threads done; class2 
results depend on class1 finish first

any help?



More information about the Python-list mailing list