extra-state of attribute keys

Marc Snir (snir@watson.ibm.com)
Fri, 28 Mar 1997 17:32:29 -0400

Raja correctly pointed out that I spoke a lot of nonsense in my previous
note: extra-state is attached to an attribute key, and is passed to the
call-back functions that were passed when the key was created. Thus,
extra-state is never passed from language to language.
The only clarification that is needed is that

Extra-state should not be modified by the copy or delete callback
functions. (This is obvious from the C binding, but not obvious from the
FORTRAN binding). However, these functions may update state that is
indirectly accessed via extra-state. E.g., in C, extra-state can be a
pointer to a data structure that is modified by the copy or callback
functions; in FORTRAN, extra-state can be an index into an entry in a
COMMON array that is modified by the copy or callback functions. In a
multithreaded environment, users should be aware that distinct threads may
invoke the same callback function concurrently: if this function modifies
state associated with extra-state, then mutual exclusion code must be used
to protect updates and accesses to the shared state.

The text on interoperability for attributes is still valid and needed.