(Hopefully) Simple Threading Question
James J. Besemer
jb at cascade-sys.com
Wed Dec 4 19:29:22 EST 2002
More information about the Python-list mailing list
Wed Dec 4 19:29:22 EST 2002
- Previous message (by thread): (Hopefully) Simple Threading Question
- Next message (by thread): (Hopefully) Simple Threading Question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
John Abel wrote: > Hi! > > Hopefully, this is a simple question. I have a script, made up of a few > classes, one of which is run as a thread. A main function, sorts out > the thread, everything runs OK. Now, I need to integrate this script, > into another, which also handles threads. My question is, can I put my > main function, from the original script, into a class, which is then > launched as a thread from my second script? I do it all the time. For convenience, I have a member function to run as a thread and a second member called "start..." to actually start the thread. Then the caller is less likely to make a mistake, spelling out the thread.start_new_thread() in long hand. class foo: def watcher( self ): for line in self.readline: line = line.strip() print line def start_watcher( self ): thread.start_new_thread( self.watcher, ()) -- James J. Besemer 503-280-0838 voice 2727 NE Skidmore St. 503-280-0375 fax Portland, Oregon 97211-6557 mailto:jb at cascade-sys.com http://cascade-sys.com
- Previous message (by thread): (Hopefully) Simple Threading Question
- Next message (by thread): (Hopefully) Simple Threading Question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list