Hi there. I've been reading in books and homepages about threads. Apparently, "threading" is better than "thread", right?
I've been trying to write a simple proof of concept code using "treading" inside a class. It was easely done with "thread", but it was a lot harder with "threading". I want to be able to write a program like this: class myapp(): def __init__(self): self.queue = queue.Queue() self.lock = threading.Lock() def inputthread(self): data = get_user_input() self.lock.aquire() self.queue.put(data) self.lock.notifyall() self.lock.release() def outputthread(self): self.lock.aquire() data = self.queue.get() self.lock.notifyall() self.lock.release() print data def main(self): start_inputthread() start_outputthread() wait_for_both_threads_to_end() app = myapp() app.main() All the examples I've seen was done by creating a class as a subclass of threading.Thread. Isn't there a way to make individual methods a thread like we do with the simpler "thread" module, but by using threading? Otherwise would it mean that I should write each method as a threading class. It doesn't make sense yet. Please help me. Thanks in advance. -- Med venlig hilsen/Kind regards Michael B. Arp Sørensen Programmør / BOFH I am /root and if you see me laughing you better have a backup.
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor