> > Well, why not use the stack? > > > > I am not quite familiar with the requirements on this "thread register", > > but couldn't something like this be made to work: > > #define TID *((sp & ~(STACK_SIZE-1)) + STACK_SIZE - TID_OFFSET) > > > > It assumes a fixed maximum stack size (and alignment), which it should > > be possible to meet (virtual memory is cheap). The STACK_SIZE could > > probably even be a (process global!) variable if it is not desirable > > to limit this at compile time. > > Thanks for writing this up. I had the same thought over dinner, > but I'm throughly discredited today, and it's better that it came > from someone else. ;-) That having been said, I don't think this scheme will really work. Programs do build themselves temporary stacks in the heap from time to time. Signal stacks come to mind. Regards, Kevin K.