This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

handle and structures


Hi,

Most of the objects created cyg_*_create function are refered to by an
handle (type cyg_handle_t) but in the meanwhile they need some memory to be
allocated, which address is usually passed as the  last parameter of the
*_create function (which type is cyg_thread, cyg_interrupt, etc...)

So before to call the _create function I usually do a malloc, and pass the
resulting address to the function. But since the other function to
manipulate the object only need the handle, I don't keep track of the memory
I allocated.

So who can I free the memory after the *_delete function ?
Do I have to keep track of the memory allocation for each new object?
Or can I simply assume that in fact the handle and the pointer are just the
same thing (after a typecast) so I canjust do "free(my_handle)" ?

It seems that it is the case at least for thread objects.

Thanks

A+

-- 
Fabrice Gautier
fabrice_gautier@sdesigns.com 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]