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

72 lines
5.8 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?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="Function calls that are not thread safe" />
<meta name="abstract" content="Your multithreaded application at times requires access to functions or system services that are not thread safe. There are few completely safe alternatives for calling these functions." />
<meta name="description" content="Your multithreaded application at times requires access to functions or system services that are not thread safe. There are few completely safe alternatives for calling these functions." />
<meta name="DC.Relation" scheme="URI" content="rzahwmulco.htm" />
<meta name="DC.Relation" scheme="URI" content="rzahwgloco.htm" />
<meta name="DC.Relation" scheme="URI" content="rzahwjobco.htm" />
<meta name="DC.Relation" scheme="URI" content="rzahwsafco.htm" />
<meta name="DC.Relation" scheme="URI" content="rzahwclcco.htm" />
<meta name="DC.Relation" scheme="URI" content="rzahwsynco.htm" />
<meta name="DC.Relation" scheme="URI" content="rzahwoneco.htm" />
<meta name="DC.Relation" scheme="URI" content="rzahwcomco.htm" />
<meta name="DC.Relation" scheme="URI" content="rzahwileco.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="rzahwnon-nonco" />
<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>Function calls that are not thread safe</title>
</head>
<body id="rzahwnon-nonco"><a name="rzahwnon-nonco"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Function calls that are not thread safe</h1>
<div><p>Your multithreaded application at times requires access to functions
or system services that are not thread safe. There are few completely safe
alternatives for calling these functions.</p>
<p>To illustrate the alternatives, consider the example of a program that
calls API <span class="apiname">foo()</span>. Because
function <span class="apiname">foo()</span> is listed as not being thread
safe, you need to find a safe way to call it. Two common options are using
a global mutual exclusion (mutex) or using a separate job to run the function
that is not thread safe.</p>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rzahwgloco.htm">Use global mutexes to run functions that are not threadsafe</a></strong><br />
One alternative you should consider when you need to call a function that is not threadsafe is using a global mutual exclusion (mutex) to run these functions.</li>
<li class="ulchildlink"><strong><a href="rzahwjobco.htm">Use separate jobs to run functions that are not threadsafe</a></strong><br />
There are several threadsafe mechanisms to submit a new job to complete the processing you need.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzahwmulco.htm" title="If you are going to write multithreaded applications or server applications for i5/OS, you should be familiar with several techniques.">Multithreaded programming techniques</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><a href="rzahwsynco.htm" title="When you create code that is threadsafe but still benefits from sharing data or resources between threads, the most important aspect of programming becomes the ability to synchronize threads.">Synchronization techniques among threads</a></div>
<div><a href="rzahwoneco.htm" title="At times, you might want to defer the initialization of resources until a thread requires them. However, your application might require that multiple threads use a certain resource, which requires you to initialize the resource only once in a threadsafe way.">One-time initialization and thread safety</a></div>
<div><a href="rzahwcomco.htm" title="Several programming errors often occur when writing multithreaded applications.">Common multithreaded programming errors</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="rzahwclcco.htm" title="The Integrated Language Environment (ILE) CL run time and compiler-generated code are threadsafe. Original program model (OPM) CL programs are not threadsafe.">CL commands and thread safety</a></div>
<div><a href="rzahwileco.htm" title="You can create an Integrated Language Environment (ILE) COBOL or ILE RPG module that will run safely in a multithreaded environment by serializing access to the module.">Threads considerations for ILE COBOL and RPG language</a></div>
</div>
</div>
</body>
</html>