Skip to content

Ability to synchronously drain a thread safe function #31531

Open
@legendecas

Description

@legendecas

Is your feature request related to a problem? Please describe.
Since TSFN provides a queue to caching up calls to the creating thread, we don't have the ability to drain the queue if we think it's time to complete the job.

Describe the solution you'd like
Add a drain method to synchronously drain the threadsafe function (maybe mark it as closed too).

Describe alternatives you've considered
Release the tsfn with napi_release_threadsafe_function(tsfn, napi_tsfn_release) and wait the finalizer to be called asynchronously.

Metadata

Metadata

Assignees

No one assigned

    Labels

    node-apiIssues and PRs related to the Node-API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions