Giovanni Mascellani (@giomasce) commented about libs/vkd3d/vkd3d_private.h:
+static inline bool vkd3d_tls_key_set_value(const struct vkd3d_tls_key *key, void *value) {
- FlsSetValue(key->key, value);
- return 0;
- if (!FlsSetValue(key->key, value))
- {
ERR("Failed to allocate TLS key, err %u.\n.", GetLastError());
return false;
- }
- return true;
}
static inline void *vkd3d_tls_key_get_value(const struct vkd3d_tls_key *key) {
- /* The descriptor object cache uses this function, which means performance is too
* critical to allow use of SetLastError() and GetLastError(). */
It's a bit annoying that `GetLastError()` and `SetLastError()` resolve to a function call instead of just getting and setting a field on the PEB. Their overhead is still quite small, I guess, when I can pass on this.