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