Symbian3/SDK/Source/GUID-4C406E49-7726-5620-AAAA-84C33DADAF4B.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-4C406E49-7726-5620-AAAA-84C33DADAF4B" xml:lang="en"><title>Opening
a handle to an existing global Kernel object</title><shortdesc>This document describes how to find a global kernel object by using
a handle.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>A handle can be opened on an existing global Kernel object.</p>
<p>Global Kernel objects are explicitly named by their creators; the technique
for finding these objects involves using a search pattern to search for objects
with matching full names. The <codeph>TFindHandleBase</codeph> provides the
basic behavior.</p>
<p>In practice, each specific type has its own class derived from <codeph>TFindHandleBase</codeph>,
for example, semaphores have <codeph>TFindSemaphore</codeph>, mutexes have <codeph>TFindMutex</codeph> and
so on.</p>
<p>For example, the following code fragment searches for the first global
semaphore whose full name ends with the characters "day" and opens a thread-relative
handle on that semaphore:</p>
<codeblock id="GUID-C1C801A9-4B15-5369-8007-17BB7DC3E0A9" xml:space="preserve">_LIT(KDay,"*day");
...
TFindSemaphore finder(KDay);       // derived from TFindHandleBase
TFullName      theName;
RSemaphore     theSem;             // derived from RHandleBase
...
if ((finder.Next(thename))==KErrNone)
    {
       theSem.Open(finder,EOwnerThread);
       ...
       }
...
</codeblock>
</conbody></concept>