What happens when calling start() on a thread several times

If I call start() on thread A, causing it to run, and then call start() again while it's still running, what happens?

Example:

myThread.start();

// myThread is running...  

myThread.start(); 

Answers


An IllegalThreadState exception will be thrown. There is no way to get a thread back to the "waiting to be started" state after it has been started, so whatever the state the thread is in after the first start, it will be in the wrong state for the second one.


Need Your Help

JavaScript Execution Order Problem

javascript

The following works correctly:

MySQL 5-star rating datatype?

mysql enums rating

Would ENUM('1','2','3','4','5') be a sensible datatype for a product rating which must be between 1 and 5?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.