This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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

JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Defining threads" Watch "Defining threads" New topic

Defining threads

Sam Bluesman
Ranch Hand

Joined: Nov 21, 2004
Posts: 191

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?



Moosey knows best
Henry Wong

Joined: Sep 28, 2004
Posts: 20037

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


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
Have you checked out Aspose?
subject: Defining threads
It's not a secret anymore!