Skip to content

Pass AbortSignal to C code #4539

@dormeiri-port

Description

@dormeiri-port

Node.js Version

v22.13.1

NPM Version

v10.9.2

Operating System

MacOS Sequoia 15.2

Subsystem

Other

Description

I’m working with an AbortSignal and some C code (extern "C"). I need to pass a reference of AbortSignal.aborted (a boolean) to the C code, which is running in async work.

Right now, I’m using a bool * and addEventListener in C++ with NAPI to update the boolean pointer which is passed to the C code, but this hurts performance. Is there a way to directly reference aborted from C?

Thanks!

Minimal Reproduction

No response

Output

No response

Before You Submit

  • I have looked for issues that already exist before submitting this
  • My issue follows the guidelines in the README file, and follows the 'How to ask a good question' guide at https://stackoverflow.com/help/how-to-ask

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions