[En-Nut-Discussion] Thread private date

Nathan Moore nategoose at gmail.com
Tue Feb 26 21:38:06 CET 2008


>
> 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



More information about the En-Nut-Discussion mailing list