Skip to content

Conversation

@mir-huzaif
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the callback mechanism to be thread-safe by replacing the Napi::AsyncWorker pattern with Napi::ThreadSafeFunction. The changes consolidate callback handling into a single CallbackWrapper class and add mutex protection for callback map operations.

Key Changes:

  • Replaced AsyncWorker-based callbacks with ThreadSafeFunction for proper thread-safe callback invocation
  • Unified CallbackWrapper and ReleaseUpdateCallbackWrapper into a single polymorphic CallbackWrapper class
  • Added mutex protection for callback map modifications during registration
  • Implemented proper cleanup of existing callbacks before replacing them

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
src/native/CallbackWrapper.h Complete refactor from AsyncWorker to ThreadSafeFunction pattern with data structures for different callback types
src/native/main.cpp Added mutex for callback map protection, updated callback registration functions with cleanup logic, modified callback invocation to use new Call() methods

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants