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

62 lines
3.8 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="Mixing thread models" />
<meta name="abstract" content="Do not mix Pthreads APIs with other thread management APIs that might be provided by the system." />
<meta name="description" content="Do not mix Pthreads APIs with other thread management APIs that might be provided by the system." />
<meta name="DC.Relation" scheme="URI" content="rzahwcomco.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="rzahwmix-mixco" />
<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>Mixing thread models</title>
</head>
<body id="rzahwmix-mixco"><a name="rzahwmix-mixco"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Mixing thread models</h1>
<div><p>Do not mix Pthreads APIs with
other thread management APIs that might be provided by the system.</p>
<div class="section"><p>For example, you should not use Java™ or the IBM<sup>®</sup> Open Class libraries threads implementations
in the same thread or process as Pthreads. More importantly, do not attempt
to manipulate a thread from one threads implementation with the API of another.
Unpredictable results might occur.</p>
</div>
<div class="section"><p>For example, you can manipulate the priority of a
thread by using Pthread interfaces and non-Pthread interfaces. If you do so,
the priority is always set correctly. However, the priority returned from
the Pthread interface <span class="apiname">pthread_getschedparam()</span> is correct
only if setting the priority was always done using either the <span class="apiname">pthread_setschedparam()</span> interface
or some other interface, but not both. If you instead use multiple interfaces
to set the priority of the thread, <span class="apiname">pthread_getschedparam()</span> always
returns the priority that was set by the last use of the <span class="apiname">pthread_setschedparam()</span> interface.</p>
</div>
<div class="section"><p>Similarly, you can end a Java thread
using the <span class="apiname">pthread_exit()</span> API if you are running application
code in a native method. However, using <span class="apiname">pthread_exit()</span> to
end the Java thread can have unexpected repercussions. These
can include bypassing some of the Java environment thread processing or perhaps
ending the Java thread in a way that your Java application
does not expect and cannot handle.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzahwcomco.htm" title="Several programming errors often occur when writing multithreaded applications.">Common multithreaded programming errors</a></div>
</div>
</div>
</body>
</html>