(Hopefully) Simple Threading Question
John Abel
johnfabel at btinternet.com
Sat Dec 14 14:44:07 EST 2002
More information about the Python-list mailing list
Sat Dec 14 14:44:07 EST 2002
- Previous message (by thread): metaclasses and static methods
- Next message (by thread): (Hopefully) Simple Threading Question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi! Sorry for the delay. Thanks for that, it was what I wondering! Thanks John James J. Besemer wrote: > > > 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, ()) > > >
- Previous message (by thread): metaclasses and static methods
- Next message (by thread): (Hopefully) Simple Threading Question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list