From 0f74ee5cbf1faffcb986da37791fbbece28a9b7b Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 11 May 2017 09:53:35 -0400 Subject: [PATCH] doc: clarify operation of napi_cancel_async_work Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/12974 Reviewed-By: Gibson Fahnestock Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Jason Ginchereau --- doc/api/n-api.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 348f2ad04466bd..423e71859dea94 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -2931,11 +2931,12 @@ NAPI_EXTERN napi_status napi_cancel_async_work(napi_env env, Returns `napi_ok` if the API succeeded. -This API cancels a previously allocated work, provided -it has not yet been queued for execution. After this function is called +This API cancels queued work if it has not yet +been started. If it has already started executing, it cannot be +cancelled and `napi_generic_failure` will be returned. If successful, the `complete` callback will be invoked with a status value of `napi_cancelled`. The work should not be deleted before the `complete` -callback invocation, even when it was cancelled. +callback invocation, even if it has been successfully cancelled. [Aynchronous Operations]: #n_api_asynchronous_operations