napi_call_threadsafe_function

Function napi_call_threadsafe_function 

Source
pub unsafe extern "C" fn napi_call_threadsafe_function(
    func: napi_threadsafe_function,
    data: *mut c_void,
    is_blocking: napi_threadsafe_function_call_mode,
) -> napi_status
Available on crate feature napi only.
Expand description

Calls a thread-safe function.

§Arguments

  • func - The created thread-safe function.

  • data - Data passed to the callback function ‘call_js_cb’ which is registered by calling ‘napi_create_threadsafe_function()’.

  • is_blocking - If true, this function blocks until the event queue is not full. If false, return directly.

§Returns

  • Returns the function execution status. [napi_ok] If the function executed successfully.

[napi_invalid_arg] If func is nullptr.

[napi_queue_full] If event queue is full.

[napi_closing] If the thread-safe function is closing.

[napi_generic_failure] If call thread-safe function failed.

Available since API-level: 10