By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,961 Members | 1,320 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,961 IT Pros & Developers. It's quick & easy.

Meaning of: Thread.currentThread() == thread ?

P: n/a
Hey
In the run method of an io-thread I saw this:

while(Thread.currentThread() == thread) { ... }

Where 'thread' is an instance variable.
What is the purpose of this check?
Regards Jesper
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Fri, 09 Apr 2004 12:57:36 +0100, Jesper Matthiesen wrote:
Hey
In the run method of an io-thread I saw this:

while(Thread.currentThread() == thread) { ... }

Where 'thread' is an instance variable.
What is the purpose of this check?
Regards Jesper


To know when you have to escape the thread because of a change somewhere
(possibly in another thread) you can make a variable that points to the
current thread and once that change occurs, have it point elsewhere, after
which you escape the thread (let it end).

greets,
Wim
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.