63 lines
4.0 KiB
HTML
63 lines
4.0 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html lang="en-us" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="security" content="public" />
|
|
<meta name="Robots" content="index,follow" />
|
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|
<meta name="DC.Type" content="concept" />
|
|
<meta name="DC.Title" content="Wait for a thread to end" />
|
|
<meta name="abstract" content="When using threads, it is important to know when a thread has finished processing. Waiting for a thread to perform an action or an event to happen is called thread synchronization." />
|
|
<meta name="description" content="When using threads, it is important to know when a thread has finished processing. Waiting for a thread to perform an action or an event to happen is called thread synchronization." />
|
|
<meta name="DC.Relation" scheme="URI" content="rzahwtwoco.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rzahwe14rx.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rzahwex3rx.htm" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="rzahwwat-watco" />
|
|
<meta name="DC.Language" content="en-us" />
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|
<title>Wait for a thread to end</title>
|
|
</head>
|
|
<body id="rzahwwat-watco"><a name="rzahwwat-watco"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Wait for a thread to end</h1>
|
|
<div><p>When using threads, it is important to know when a thread has finished
|
|
processing. Waiting for a thread to perform an action or an event to happen
|
|
is called thread synchronization.</p>
|
|
<p>It is typically sufficient to wait for a thread to end. When the thread
|
|
ends, the application is alerted that the work the thread was assigned is
|
|
complete or the thread failed. If a status is set by the thread and is supported
|
|
by your specific API set, you can use the status to determine whether the
|
|
thread successfully completed its work.</p>
|
|
<p>When a thread ends, the system reclaims its resources for reuse. You can
|
|
also wait for a thread to end to reclaim more of the thread's resources for
|
|
use by other threads.</p>
|
|
<p>Waiting for a group of threads to end can also be a good way for a larger
|
|
application, such as a server, to give large amounts of application work to
|
|
"worker" threads and have a single "boss" thread coordinate the work of the
|
|
subordinate threads. Your API set can directly support this kind of waiting.</p>
|
|
</div>
|
|
<div>
|
|
<ul class="ullinks">
|
|
<li class="ulchildlink"><strong><a href="rzahwe14rx.htm">Example: Wait for threads in a Pthread program</a></strong><br />
|
|
This example shows a Pthread program starting several threads, waiting for them to finish, and checking their status after they complete.</li>
|
|
<li class="ulchildlink"><strong><a href="rzahwex3rx.htm">Example: Wait for threads using Java</a></strong><br />
|
|
This example shows a Java™ program starting several threads, waiting
|
|
for them to finish, and checking their status after completion.</li>
|
|
</ul>
|
|
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzahwtwoco.htm" title="The concepts described here pertain to all programming languages.">i5/OS thread management</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |