after i'm done uv_async_t
, i'm supposed destroy avoid leaks, right? glancing @ docs, appears i'm supposed use uv_close()
this, takes uv_handle_t*
, not uv_async_t*
. furthermore, looks casting (as in uv_close((uv_handle_t *)async, null)
) cause strict aliasing violation. i'm supposed anyway?
yes, have cast uv_async_t*
uv_handle_t*
. that's how libuv internally works.
all handles share base structure, iirc strict aliasing rules not broken because amounts casting first member of structure.
a note on example call uv_close
: can free memory handle in close callback, not before, if pass null , handle allocated on heap won't know when can free memory.
Comments
Post a Comment