[En-Nut-Discussion] Thread private date

Ole Reinhardt ole.reinhardt at embedded-it.de
Tue Feb 26 21:07:36 CET 2008


Hi Ernst,

> I seem to be a bit slow today, but why is such a pointer "more" thread-
> privat than a pointer just declared within the thread? 

Ok, it's not more nor less privat than a pointer declared within the
thread, but the advantage is, that you won't have to pass this pointer
to every function of your code. Will say, any function can figure out
which thread is calling it.

This could be realy convenient to work on e.g. buffers. Another usage
could be to provice thread specific banked memory. Every thread could
get a banked memory page assigned an simply has to 

swich_bank(*NutThreadGetPrivate()) 

for example.

I saw this concept in another conext and thought it could be a quite
simple but usefull extension.

> One more question: Why will it "break existing applications" when the size
> of a Nut/OS internal data structure changes? I would think that, if the
> application is coded up to generally accepted standards, it will determine
> the size of the structure's element and thus being able to "run" thru the
> list.

Right. It will only break existing code if you have precompiled code
getting linked... You just have to recompile the whole thing and
everything should worke fine as long as nobody uses hard coded offsets.

Bye,

Ole Reinhardt

-- 
 _____________________________________________________________
|                                                             |
| Embedded-IT          Hard- und Softwarelösungen             |
|                                                             |
| Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
| Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
| 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
| Germany              Web:         http://www.embedded-it.de |
|                      UstID / VAT:       DE198944716         |
|_____________________________________________________________|




More information about the En-Nut-Discussion mailing list