Introduction to Java threads
This tutorial is for Java programmers who have a good working knowledge of the Java. language, but who have limited experience with multithreading or concurrency. ...
At the completion of this tutorial, you should be able to write simple programs that use
threads. You should also be able to read and understand programs that use threads in
straightforward ways.
Threading is a facility to allow multiple activities to coexist within a single process. Most
modern operating systems support threads, and the concept of threads has been around in
various forms for many years. Java is the first mainstream programming language to
explicitly include threading within the language itself, rather than treating threading as a
facility of the underlying operating system.
The Thread API contains a method for waiting for another thread to complete: the
join()
method. When you call
Thread.join()
, the calling thread will block until the target thread
completes.
Thread.join()
is generally used by programs that use threads to partition large problems
into smaller ones, giving each thread a piece of the problem. The example at the end of this
section creates ten threads, starts them, then uses
Thread.join()
to wait for them all to
complete...
Source: www.freejavaguide.com
Related PDF Files
Topic:
Comments for Introduction to Java threads