Joe Orton wrote:
What I do with OpenSSL in neon is to check that the existing callback is
NULL before registering a new callback; and likewise to check that the
ID callback is the one neon previously registered before un-registering
it later. If everybody did that it would be relatively safe.
Is there an API to get the current value ?
It shouldn't be too hard to attach a piece of memory to a keyed
namespace which the core module maintains. 3 primitives should do the
trick. data = get(key), set(key, data), set_if_null(key, data) where
the set_if_null() operation is especially thread-safe.
This would be little impact/bloat on core module, but be user extendable
to allow other such things. Someone just needs to maintain an assigned
key value list.
A notice board for modules to talk to each other.
The OpenSSL guys have actually obviated the ID callback for some future
release, it was entirely unportable because of the cast-to-long issue
anyway; but the locking callback remains.
(void *) in the latest releases AFAIK. This is to address this very
concern.
Darryl