ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahw_5.4.0.1/rzahwgrxco.htm

88 lines
6.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="reference" />
<meta name="DC.Title" content="Activation groups and threads" />
<meta name="abstract" content="All programs and service programs are activated within a substructure of a job that is called an activation group. This substructure contains the resources necessary to run the programs, including static and heap storage, and temporary data management resources." />
<meta name="description" content="All programs and service programs are activated within a substructure of a job that is called an activation group. This substructure contains the resources necessary to run the programs, including static and heap storage, and temporary data management resources." />
<meta name="DC.Relation" scheme="URI" content="rzahwas4co.htm" />
<meta name="DC.Relation" scheme="URI" content="rzahwsafco.htm" />
<meta name="DC.Relation" scheme="URI" content="rzahwsafco.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="rzahwgrx-grxco" />
<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>Activation groups and threads</title>
</head>
<body id="rzahwgrx-grxco"><a name="rzahwgrx-grxco"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Activation groups and threads</h1>
<div><p>All programs and service programs are activated within a substructure
of a job that is called an activation group. This substructure contains the
resources necessary to run the programs, including static and heap storage,
and temporary data management resources.</p>
<div class="section"><p>In a job capable of multithreaded operation, two
or more threads can share an activation group. A thread can run programs that
were activated in different activation groups. The system does not keep a
list of threads that run in an activation group or a list of activation groups
in a thread. Ending an activation group while other threads are active in
it can produce unpredictable results including abnormal end of the process.
To avoid these problems, any action that ends an activation group in a secondary
thread causes the system to end the job in an orderly fashion. In other words,
the system ends all threads in the job, calls exit routines and C++ destructors
in the initial thread, and finally closes the files.</p>
</div>
<div class="section"><div class="p">When working with activation groups, consider
the following items:<ul><li>Return from activation groups:<p>Programs created with <span class="parmname">ACTGRP(*NEW)</span> get
a new activation group every time it is called. When the program returns,
the new activation group ends. In jobs capable of multithreaded operation,
returning from programs that were created with <span class="parmname">ACTGRP(*NEW)</span> will
end the job.</p>
<p>Both <span class="filepath">default</span> and <span class="filepath">named</span> activation
groups are persistent. The <span class="filepath">Default</span> activation group is
created when a job starts and is destroyed only when the job ends. <span class="filepath">Named</span> activation
groups are created when they are first needed in a job. A normal return from
the named activation group leaves the activation group in last-used state,
but does not delete the activation group. Hence, in a job capable of multithreaded
operations, a normal return from the <span class="filepath">default</span> or <span class="filepath">named</span> activation
group does not cause the job to end. </p>
<p>Using <span class="apiname">exit()</span> or <span class="apiname">abort()</span> in
any activation group in a secondary thread always ends the job.</p>
</li>
<li>Unhandled exceptions:<p>If an exception has not been handled by the time
it has percolated to the control boundary and the control boundary is a program
entry procedure (PEP or main entry point), the multithread-capable job is
ended. </p>
</li>
<li><span class="cmdname">Reclaim activation group (RCLACTGRP)</span>:<p>Jobs
capable of multithreaded operation allow this command to be called only in
the initial thread on the job. If secondary user threads are present in the
job, this command sends a CPF180B escape message to the caller of the command.</p>
</li>
</ul>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzahwas4co.htm" title="All programs have at least one thread, referred to as the initial thread. In a program with multiple threads, each thread runs its code independently of the other threads in the program.">Threads on i5/OS</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="rzahwsafco.htm" title="A function is threadsafe if you can start it simultaneously in multiple threads within the same process. A function is threadsafe if and only if all the functions it calls are also threadsafe.">Thread safety</a></div>
</div>
</div>
</body>
</html>