[Tutor] How to use threads ?
mark.kels at gmail.com
Thu Mar 3 16:53:11 CET 2005
On Thu, 3 Mar 2005 14:31:55 +0000, Gwyn Evans <gwyn.evans at gmail.com> wrote:
> The one thing that stands out is that when you subclass Thread as
> you do, you need to override the 'run' method, which will get called
> as a result of you calling 'start()'.
> You're calling start(), but you've not got a run method, so the new
> thread doesn't call your code. Instead you've got your own call to
> 'scanner()', that is running under the main thread.
> Rename 'scanner()' to 'run()', remove the call to 'scanner()' and
> see how that looks.
It looks the same, but with 1 line less...
The thread is still working after the loop is done, so after I stop
the scan I cant start another one.
1. The day Microsoft makes something that doesn't suck is probably the
day they start making vacuum cleaners.
2. Unix is user friendly - it's just picky about it's friends.
3. Documentation is like sex: when it is good, it is very, very good.
And when it is bad, it is better than nothing. - Dick Brandon
More information about the Tutor