How does Linux pthreads identify the thread control structure?
R Sharada wrote: > I have a query related to how Liux pthreads implementation > idnetifies the thread control structure or descr for a current thread, > in the case when the stack is non-standard ( by way of having called a > setstackaddr /setstacksize ). First off, don’t ever use pthread_attr_setstackaddr(), because it’s a completely brain-damaged interface that’s inherently broken and totally nonportable. I’ve explained why it’s broken (both in terms of engineering features and political history), and I won’t repeat it here. (You can always search the archives.) Just don’t use it. The next version of POSIX and UNIX (2001) contains my corrected version, which ended up being named pthread_attr_setstack(). At some point, this will begin to appear on Linux and other systems. > Currently the method ( in thread_self > routine ) just parses through the whole list of threads until one > matches the current sp and then obtains the descr from there. This could > get quite slow in conditions wh