This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Splash Screen  RSS feed

 
Sayed Ibrahim Hashimi
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying to create a program that will have a Splash Screen and I have 2 threads, one to start the program and one to display the splash screen. After the splash screen is no longer being displayed I want the thread to no longer run. How can I make sure this will happen? This is my first attempt at a multi-threaded application.
Thanks.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once the run() method exits normally, the thread dies a "natural death". Do NOT use the stop() method since it's depracated.
You can check wether the thread is dead or alive with the isAlive() method. This will return false if the thread is dead, OR if the thread is new and not runnable. For example, this would be a new and not runnable thread:

In this case, isAlive() returns false.
Once you do this,

the thread is NOT new, it's runnable (even if it hasn't had the chance to start running), and isAlive() returns true.
 
Sayed Ibrahim Hashimi
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I thought that was what would happen, but I wasn't sure if it was still taking resources or not.
Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!