Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When is a thread considered Active

Rahul Mahindrakar
Ranch Hand
Posts: 1869
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) A thread is considered active sometime after the start method is called of the thread is called and a short period after the thread has stopped.
2) A thread is considered active whose thread reference appears in the activeCount() method returned. A thread reference first appears in the activeCount method when the thread object is first constructed and when the thread is started.
check this out. The results returned by the program below are the active threads.

Note that only when LINE 1 is not commented is Thread first is being printed out else it is not. Thus only when a thread is started is a thread active.
Also isAlive() will return true at all states except when the thread is in new state or dead state

Rahul P. Mahindrakar

[This message has been edited by Rahul Mahindrakar (edited August 18, 2000).]
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic