You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, it looks like it's unsafe to call napi_queue_async_work twice with the same napi_async_work if the first napi_async_complete_callback has yet to fire. I ran into this issue when porting my Native Addon from NAN to N-API. I can work around it easily, but it took a while to track down (all I was seeing was EXC_BAD_ACCESS). Perhaps the documentation should be updated to reflect this? Here's one option (new text in bold):
This API requests that the previously allocated work be scheduled for execution. Do not call this API again if the work is not yet canceled or completed.
I haven't actually tested the cancel case.
The text was updated successfully, but these errors were encountered:
ChALkeR
added
doc
Issues and PRs related to the documentations.
node-api
Issues and PRs related to the Node-API.
and removed
doc
Issues and PRs related to the documentations.
labels
Apr 13, 2019
Add note to `napi_queue_async_work()` indicating that, upon successful
return, it must not be called again with the same work item.
Fixes: nodejs#27217
PR-URL: nodejs#27582
Add note to `napi_queue_async_work()` indicating that, upon successful
return, it must not be called again with the same work item.
Fixes: #27217
PR-URL: #27582
Reviewed-By: Franziska Hinkelmann <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Hi, it looks like it's unsafe to call
napi_queue_async_work
twice with the samenapi_async_work
if the firstnapi_async_complete_callback
has yet to fire. I ran into this issue when porting my Native Addon from NAN to N-API. I can work around it easily, but it took a while to track down (all I was seeing wasEXC_BAD_ACCESS
). Perhaps the documentation should be updated to reflect this? Here's one option (new text in bold):I haven't actually tested the cancel case.
The text was updated successfully, but these errors were encountered: