[ECOS] about Per Thread Data
Fri Oct 6 05:15:00 GMT 2000
Fabrice Gautier <Fabrice_Gautier@sdesigns.com> writes:
> 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
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
More information about the Ecos-discuss