[En-Nut-Discussion] Thread private date

Ernst Stippl ernst at stippl.org
Tue Feb 26 22:19:55 CET 2008


Hi!

Thanks fort the clarification, guys. I do understand what can be achieved
thru it.

Regards
Ernst 

-----Ursprüngliche Nachricht-----
Von: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] Im Auftrag von Nathan Moore
Gesendet: Dienstag, 26. Februar 2008 21:38
An: Ethernut User Chat (English)
Betreff: Re: [En-Nut-Discussion] Thread private date

>
> 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.
>
So you could do something like give every thread a different default stderr,
stdin, and
stdout which would be in the thread local area.  Calling printf would
automatically
use the calling thread's stdout and calling perror would use the thread's
stderr.


>
> 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'd thought about this in conjunction with banked memory before but for
systems without
it I didn't see the real use.  What you suggested might be a good idea
though.

Nathan
_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion



-- 
No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.0/1296 - Release Date: 24.02.2008
12:19





More information about the En-Nut-Discussion mailing list