I am learning about POSIX threads and I have come to the section on Thread Specific Data. The book does an excellent example using a file descriptor. However, I wanted to do the
In general, what you're looking for is "thread local storage". Here are a few links:
http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Frzahw%2Frzahwex1.htm
http://en.wikipedia.org/wiki/Thread-local_storage
Choosing pthread_getspecific()
is correct. Here's a good example:
Please review the above example: I think it will point you to the problem ... or suggest a good alternative.
IMHO...