Nikolay Sivov (@nsivov) commented about dlls/rtworkq/queue.c:
if (!out) return E_INVALIDARG;
- if (!(result = calloc(1, sizeof(*result))))
return E_OUTOFMEMORY;
- RtwqLockPlatform();
- if (!(result = async_result_cache_pop()))
- {
if (!(result = calloc(1, sizeof(*result))))
return E_OUTOFMEMORY;
RtwqLockPlatform();
- }
Why are we caching this at all? If it's to keep object alive for longer then we don't need to push them back to the list on release, if it's to have LockPlatform/UnlockPlatform happening exactly once - lock when first result object is created and unlock only on shutdown? Or is additional goal to avoid frequent heap allocations?