Giovanni Mascellani (@giomasce) commented about libs/vkd3d/vkd3d_private.h:
{ }
+typedef PFLS_CALLBACK_FUNCTION vkd3d_tls_destructor_fn; + +static inline int vkd3d_tls_key_create(struct vkd3d_tls_key *key, vkd3d_tls_destructor_fn destructor) +{ + if ((key->key = FlsAlloc(destructor)) == FLS_OUT_OF_INDEXES) + return -1; + return 0; +} + +static inline int vkd3d_tls_key_set_value(const struct vkd3d_tls_key *key, void *value) Similarly to mutex functions, I'd assume that we cannot reasonably react to `vkd3d_tls_key_set_value()` and `vkd3d_tls_key_get_value()` failing, so I think they should return `void` and log whatever error they happen to step into. The "backend" functions should probably never fail, and if they do it means that the whole process is probably in a huge mess.
Notice also that `FlsSetValue()` can return an error, which I think should be logged, and `FlsGetValue()` can return an error too, which can be detected by calling `SetLastError()` before calling `FlsGetValue()`. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/384#note_48508