*
The moose likes Threads and Synchronization and the fly likes Defining threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Defining threads" Watch "Defining threads" New topic
Author

Defining threads

Sam Bluesman
Ranch Hand

Joined: Nov 21, 2004
Posts: 191
Hi.

I am new to threads and was wondering:

My program is running as a single thread i.e. there is no thread defined - it just runs. Now, I need to create a new thread which I have done succesfully ( i think ). What I would like to know is that if my main program requires a new thread to run as above, so that two things can run concurrently, should I define what was previsouly the main program as a thread as well - or is just defining the new thread i need enough?

Thanks,

Sam


Moosey knows best
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18497
    
  40

The main() method is called using the main thread -- which is already a thread.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Sam Bluesman
Ranch Hand

Joined: Nov 21, 2004
Posts: 191
I see. Thanks Henry.
Maris Orbidans
Ranch Hand

Joined: Mar 08, 2004
Posts: 149
a new thread is enough
 
Don't get me started about those stupid light bulbs.
 
subject: Defining threads
 
Similar Threads
Another One from Threads...
How to kill an slepping thread ?
Threads
Threads - enough is enough
Daemon threads & non daemon Threads