This is the mail archive of the
mailing list for the eCos project.
Re: thread specific data
On Tue, Feb 12, 2002 at 04:49:58PM +0100, Tom Coremans wrote:
> When I put cyg_thread_new_data_index() in my code, ecos will return me an
> index that is free and that I can use for thread_specific_data.
> But how can I be sure that I get the same index over and over again when I
> initialise and make new threads? It is that index that I need later in the
> program to get the specific data out of the different threads so the index
> must be the same for all my threads.
You need to call cyg_thread_new_data_index() once and then use some
mechanism to pass it to whoever needs it. Put it in a global variable,
pass it in the data part when starting a new thread, pass it using a
message box, who cares?
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss