| Author |
simple deadlock problem
|
vijay kaushik
Greenhorn
Joined: Jul 11, 2005
Posts: 3
|
|
what it mean? don't these two statements have the same meaning i.e. currentThread and This statement plz clarify the difference, deadlock() { Thread.currentThread().setName("MainThread"); Thread t = New Thread (this,"racingThread"); t.start();
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24057
|
|
I don't understand why the subject line of this message mentions "deadlock" -- the question seems unrelated to this. Thread.currentThread() returns a Thread object, the currently executing Thread. "this" refers to the object whose method is being called. "this" and currentThread() will only return the same thing in the relatively rare circumstance that you've subclassed Thread and the code being executed is in that subclass. If you instead implemented Runnable, or if your Thread's code is calling out to other code in another class, then "this" and "currentThread()" will refer to different objects, of course.
|
[Jess in Action][AskingGoodQuestions]
|
 |
 |
|
|
subject: simple deadlock problem
|
|
|