penguin
penguin copied to clipboard
parallel: add support to explicitly destroy TLS keys
In most modern pthread implementations, the TLS key does not create heap allocations. However, this is not true for all implementations of TLS. Extend the interface to permit the destruction of the key to release resources.
Also add an implementation which conforms to the POSIX threading interfaces.
Extend the change a bit further to allow for the resetting of the key itself to a TLS implementation specific invalid value. Although this unconstifies the value, it will make it easier to identify invalid uses of the key (e.g. use-after-free).