Thread Question
Grant Edwards
grante at visi.com
Tue Feb 28 15:24:18 EST 2006
On 2006-02-28, D <duncanm255 at hotmail.com> wrote:
> I have a client application that I want (behind the scenes) to check
> and make sure a remote host is up (i.e. by ping or TCP connect). I'm
> assuming that, since I want this to go on "unknowingly" to the user,
> that I would put this in a thread.
Probably.
> My question is, how would I go about creating the thread?
Assuming foo is the function you want to start in a thread:
threading.Thread(target=foo).start()
> I have seen examples that used classes, and other examples
> that just called one thread start command - when should you
> use one over another?
I'm not sure what you mean by "use classes" vs. "calling a
thread start command". My example above uses a class
(threading.Thread) to create a thread object, and then calls
its start method.
--
Grant Edwards grante Yow! HELLO, little boys!
at Gimme a MINT TULIP!! Let's
visi.com do the BOSSA NOVA!!
More information about the Python-list
mailing list