This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: thread specific data
- From: Andrew Lunn <andrew dot lunn at ascom dot ch>
- To: Tom Coremans <tom dot coremans at acunia dot com>
- Cc: eCos users <ecos-discuss at sources dot redhat dot com>
- Date: Tue, 12 Feb 2002 15:33:32 +0100
- Subject: Re: [ECOS] thread specific data
- References: <3C692601.7DB4B1F1@acunia.com>
On Tue, Feb 12, 2002 at 03:26:09PM +0100, Tom Coremans wrote:
> I want to use the cyg_thread_set_data (index, data) function in
> ecos. Do I have to call the cyg_thread_new_data_index() first to
> get an index or can I just use a random number as an index?
Some are pre-allocated to various things like the kernel, libc etc. If
you randomly pick one, expect random crashes.....
> And suspose I must use the cyg_thread_new_data_index first, is there
> a way of knowing wich index a will get??
If you knew what it was going to return, why call it?
Calling it ensure you get one eCos thinks no one else is using. Its
possible something else is just randomly picking an index an uses it,
so stomping over the data you put into it....
Andrew
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss