Novell is now a part of Micro Focus

I've been RTFMing about thread-specific data and I've...

Articles and Tips: qna

01 Feb 2002


Q.

I've been RTFMing about thread-specific data and I've been getting confused about key-value pairs and thread specific data. The more I read the sections, the less I understand.

Firstly, the docs for key-value pairs say it is a method for providing thread-specific data. However, the explanation then goes on to talk about "a pointer or scaler value that is different for each context" So surely, then, key-value pairs are context-specific data, not thread-specific data?

Secondly, in the example of thread-specific data, it mentions that things like connection IDs and the string being processed by strtok() are both things that need to be associated with the thread. Yet earlier on in the docs, it says that "The notion of a context abstracts the run-time state of a thread to which the context is bound." So should things like connection IDs, etc. be part of context-specific data? (I think I've confused myself even more just by writing this!) Anything to clear my mind on this subject matter would be appreciated.

A.

Confusion occurs because of the possibility of temporary binding between a thread and its context. The context represents the data (and work) that a thread does. In the traditional model, they are one and the same: terminate a thread, and free its data (context). However, it is possible in NKS to maintain a distinction between context (data) and the thread. However, even in NKS use, this isn't common.

* Originally published in Novell AppNotes


Disclaimer

The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.

© Copyright Micro Focus or one of its affiliates