Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Opening a handle to an existing global Kernel object

A handle can be opened on an existing global Kernel object.

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 TFindHandleBase provides the basic behaviour.

In practice, each specific type has its own class derived from TFindHandleBase, for example, semaphores have TFindSemaphore, mutexes have TFindMutex and so on.

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:

_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);
       ...
       }
...