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]

Re: about Per Thread Data


Fabrice Gautier <Fabrice_Gautier@sdesigns.com> writes:

> Hi,
> 
> Is it possible to use per thread data statically. 
> 
> I mean I would like to always keep the same information at index 0. So can I
> safely bypass "cyg_thread_new_data_index" and "cyg_thread_free_data_index" ?
> 

This is not really a good idea. To start: indexes 0..3 are reserved
for various packages. If you avoid ever using
cyg_thread_new_data_index() then you should start working from offset
4. However, beware that other packages than may need per thread data
will still be expecting you to to be playing the game, and may get
the static index you are using allocated to them. There are also
assertions in the access functions that check that the supplied index
is valid.

Perhaps the best approach is to use cyg_thread_new_data_index(), check
that the result is 4, and then use 4 statically throughout. This would
also allow the assertions in the access functions to pass. 

-- 
Nick Garnett, eCos Kernel Architect
Red Hat, Cambridge, UK

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