discussion.......handles........
| Tue, 2007-09-11 07:07 | |
|
What is a handle exactly? I have been coming acrros it a lot. then wht is a handle. Last i read about handles in symbian was |
|
| Tue, 2007-09-11 07:07 | |
|
What is a handle exactly? I have been coming acrros it a lot. then wht is a handle. Last i read about handles in symbian was |
|
Forum posts: 1242
Questions with the word "exactly" in it are always the hardest to answer...
Technically and basically, a handle is a number that identifies an object that is "living" somewhere, e.g. in the Symbian kernel. For various reasons it might not be a good idea to give a program a pointer to the object, but the object is hidden, and when you want to do something with it, you just pass its handle, its identifying number, and the object is found in a table with the help of this number before the operation starts.
The similarity to pointers is this: If you somehow loose the handle of the object in your program, you will be unable to tell the manager, the holder of the object to release it, and you might produce a memory leak this way.
But anyway, in another sense, a handle is exactly what you can do with it, defined by the methods that the particular handle class offers. I don't know of any situation where I would bother how exactly a file handle is implemented in Symbian: Whether the number is 16 bits, 32 bits, or even 64 bits, and whether subsequent numbers are used or only prime numbers, or whatever...
René Brunner
Forum posts: 1232
Yes. Just an ID number to something.
The general meaning of the english word "handle" applies also here somewhat.
The handle is what your program keeps to "hold onto" whatever object, wherever it may be.
The main difference to a pointer is that it doesn't have to point to the object. Or more exactly its value doesn't have to be an address into memory that is addressable by the current thread, that contains the object.
It is quite common though to implement handles such that their value actually are pointers, but into an address range not accessible by the current thread. Maybe kernel memory, or memory controlled by some server thread.
But the point with handles is that you don't have to care about how they are implemented, for the user, they are just an ID to something, and it can only be used with a specific set of functions.
Edit
And just to clarify, "handles" is a general computer science term, and is not specific to any operating systems. In fact, most computer systems use handles in some way.
Forum posts: 10
Mr. sandeep mohapatra ,
Handles are not similar to pointers but with restriction ,you can say its a long pointer to some data structure or class ,that doesnt want to any body to
access its internal data member. So handles are provided , hope this will create u r confusion.
Regards