[python-win32] Threading Issue
Emlyn Jones
emlynj at gmail.com
Tue Jul 3 23:22:36 CEST 2007
On 7/3/07, Emlyn Jones <emlynj at gmail.com> wrote:
> On 7/3/07, Tim Roberts <timr at probo.com> wrote:
> James Matthews wrote:
> > > So i need to make the list a global variable
> >
> > No, that's not what he did at all. The names just happened to be the
> > same, that's all. Consider it this way:
> >
> > import threading
> > def foo( threadresult ):
> > threadresult.extend( range(4) )
> >
> > result = list()
> > thread = threading.Thread(target=foo, args=(result,))
> > thread.start()
> > result
> >
How about using an object derived from Thread and making 'result' a
member of it?
http://docs.python.org/lib/thread-objects.html
You'd probably also want a variable to tell you if the function has finished.
--
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
More information about the Python-win32
mailing list