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

68 lines
4.1 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="reference" />
<meta name="DC.Title" content="Object locks" />
<meta name="abstract" content="Object locks provide ways to acquire locks on specific system or application objects." />
<meta name="description" content="Object locks provide ways to acquire locks on specific system or application objects." />
<meta name="DC.Relation" scheme="URI" content="rzahwsynco.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="rzahwobj-objco" />
<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>Object locks</title>
</head>
<body id="rzahwobj-objco"><a name="rzahwobj-objco"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Object locks</h1>
<div><p>Object locks provide ways to acquire locks on specific system or
application objects.</p>
<div class="section"><p>In some cases, the system acquires object locks on behalf of actions
a user takes against certain objects. The system respects and enforces object
locks for some actions. </p>
</div>
<div class="section"><p>You can acquire object locks such that the lock is effective only
within the thread (thread-scoped) or is effective within the process (process-scoped).
If two threads in the same process each try to acquire a process-scoped lock
to a system object, that lock is satisfied for both threads. Neither thread
prevents the other from acquiring the lock if they are in the same process. </p>
</div>
<div class="section"><p>If you are using object locks to protect access to an object from
two threads within the same process, you should use object locks that are
scoped to a thread. A thread-scoped object lock never conflicts with an object
lock scoped to a process that is acquired by the same process.</p>
</div>
<div class="section"><p>Object locks allow an application to coordinate the use of different
locking request types. More than one thread can acquire a shared but thread-scoped
lock on the same system object. Your application can also acquire different
types of object locks in a way that is similar to space locks. This allows
more than one thread to acquire a thread-scoped shared lock on a single target.</p>
</div>
<div class="section"><p>Because extra lock types are provided
by object locks, the concept of an owner is slightly different than it is
with mutual exclusions (mutexes). There can be multiple owners of a shared,
thread-scoped lock. If each owner has successfully acquired the shared thread-scoped
lock, all of the shared locks must be unlocked for a thread to get an exclusive
thread-scoped object lock.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <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>
</div>
</body>
</html>