Title: Question about ThreadSafeFunction · Issue #536 · nodejs/node-addon-api · GitHub
Open Graph Title: Question about ThreadSafeFunction · Issue #536 · nodejs/node-addon-api
X Title: Question about ThreadSafeFunction · Issue #536 · nodejs/node-addon-api
Description: Hi, I am doing some c++ native code that returns some values via a callback to the add-on on a separate thread. I am using ThreadSafeFunction to go back to the main thread and post result to the JavaScript, however to do that I am using ...
Open Graph Description: Hi, I am doing some c++ native code that returns some values via a callback to the add-on on a separate thread. I am using ThreadSafeFunction to go back to the main thread and post result to the Ja...
X Description: Hi, I am doing some c++ native code that returns some values via a callback to the add-on on a separate thread. I am using ThreadSafeFunction to go back to the main thread and post result to the Ja...
Opengraph URL: https://github.com/nodejs/node-addon-api/issues/536
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Question about ThreadSafeFunction","articleBody":"Hi,\r\nI am doing some c++ native code that returns some values via a callback to the add-on on a separate thread. I am using ThreadSafeFunction to go back to the main thread and post result to the JavaScript, however to do that I am using Promises, so I don't really need a function callback.\r\nhttps://github.com/nodejs/node-addon-api/blob/master/doc/threadsafe_function.md#new\r\n\r\nBut in all Napi::ThreadSafeFunction::New() there is no way to NOT pass a Function, which I don't really need. Am I using the right tool here to go from a worker thread back to the main thread or is there an alternative that doesn't require a Function?\r\nI think this likely should be called ThreadSafeCallback and accept either a Function or a Promise.","author":{"url":"https://github.com/marco-ms","@type":"Person","name":"marco-ms"},"datePublished":"2019-09-07T06:14:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":15},"url":"https://github.com/536/node-addon-api/issues/536"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:14b71128-a953-a27e-77aa-87873b7cc04c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8744:28E279:343535D:3513BFC:6A4F0850 |
| html-safe-nonce | c7dd6cb04a4faa5fdb9e94b0c5e5ded53b4bc76aae44699c40dd9e321efe81dc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NzQ0OjI4RTI3OTozNDM1MzVEOjM1MTNCRkM6NkE0RjA4NTAiLCJ2aXNpdG9yX2lkIjoiNzkwNjA2NTc1NDYwODMwNjI1NiIsInJlZ2lvbl9lZGdlIjoic2VhIiwicmVnaW9uX3JlbmRlciI6InNlYSJ9 |
| visitor-hmac | 4dd2bfc713bf31754ec4eb73e467777f72c18179539ccbe15c0209ca3dc7a87f |
| hovercard-subject-tag | issue:490597810 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node-addon-api/536/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a01005a4c833d28314444e0b9643acb3595e3ecf1b2b47130adb5998d5f6dd91/nodejs/node-addon-api/issues/536 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a01005a4c833d28314444e0b9643acb3595e3ecf1b2b47130adb5998d5f6dd91/nodejs/node-addon-api/issues/536 |
| og:image:alt | Hi, I am doing some c++ native code that returns some values via a callback to the add-on on a separate thread. I am using ThreadSafeFunction to go back to the main thread and post result to the Ja... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | marco-ms |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node-addon-api git https://github.com/nodejs/node-addon-api.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 81384578 |
| octolytics-dimension-repository_nwo | nodejs/node-addon-api |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81384578 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node-addon-api |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b8f23afb982271f1b22258a94aede67a6b77760 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width