• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Splash Screen  RSS feed

 
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.
 
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!