After I'm done with a uv_async_t
, I'm supposed to destroy it to avoid any leaks, right? From glancing at the docs, it appears I'm supposed to use uv_close()
for this, but it takes a uv_handle_t*
, not a uv_async_t*
. Furthermore, it looks like casting it (as in uv_close((uv_handle_t *)async, NULL)
) would cause a strict aliasing violation. Is that what I'm supposed to do anyway?
相关问题
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs
- google-drive can't get push notifications
- How to reimport module with ES6 import
- Why is `node.js` dying when called from inside pyt
- How to verify laravel passport api token in node /
相关文章
- node连接远程oracle报错
- How can make folder with Firebase Cloud Functions
- @angular-cli install fails with deprecated request
- Is it well-defined to use memset on a dynamic bool
- node.js modify file data stream?
- How to resolve hostname to an ip address in node j
- Transactionally writing files in Node.js
- Log to node console or debug during webpack build
Yes, you have to cast the
uv_async_t*
touv_handle_t*
. That's how libuv internally works.All handles share the base structure, so IIRC strict aliasing rules are not broken because it amounts to casting it to the first member of the structure.
A note on your example call to
uv_close
: you can only free the memory for a handle in the close callback, not before, so if you pass NULL and the handle was allocated on the heap you won't know when you can free the memory.