penguin icon indicating copy to clipboard operation
penguin copied to clipboard

parallel: add support to explicitly destroy TLS keys

Open compnerd opened this issue 3 years ago • 0 comments

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).

compnerd avatar Jul 16 '20 17:07 compnerd