Re: Newbie: Thread myThread = Thread.currentThread(); ????
From: Bjorn Abelli (DoNotSpam.bjorn_abelli_at_hotmail.com)
Date: 11/19/03
- Next message: Michael Borgwardt: "Re: Newbie: Thread myThread = Thread.currentThread(); ????"
- Previous message: xarax: "Re: Newbie: Thread myThread = Thread.currentThread(); ????"
- In reply to: Zalek Bloom: "Newbie: Thread myThread = Thread.currentThread(); ????"
- Next in thread: Michael Borgwardt: "Re: Newbie: Thread myThread = Thread.currentThread(); ????"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 19 Nov 2003 18:03:23 +0100
"Zalek Bloom" ...
[Please don't crosspost.
Followup set to only comp.lang.java.help]
> What is a meaning of the line:
> Thread myThread = Thread.currentThread();
It returns the Thread-instance currently executing.
> I would understand if it was written:
> Thread myThread = new Thread() ;
> myThread = myThread.currentThread();
What you would accomplish with that is to create a *new* Thread, and in the
next sentence just abandon it, since the variable will get the reference to
another Thread-instance.
> public void run() {
> Thread myThread = Thread.currentThread();
> while (clockThread == myThread) {
It's a construction to make sure that it really is the designated Thread
you're working with, in case you have started other Threads as well.
// Bjorn A
- Next message: Michael Borgwardt: "Re: Newbie: Thread myThread = Thread.currentThread(); ????"
- Previous message: xarax: "Re: Newbie: Thread myThread = Thread.currentThread(); ????"
- In reply to: Zalek Bloom: "Newbie: Thread myThread = Thread.currentThread(); ????"
- Next in thread: Michael Borgwardt: "Re: Newbie: Thread myThread = Thread.currentThread(); ????"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|