-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Worker threads and C++ backed objects #2754
Comments
We do have a special handler for |
@addaleax thanks for a quick response. I have a follow-up question if it's ok. |
@Flackus Not sure what a custom V8 serializer would look like – of course you can write your own serializer/deserializer functions (e.g. based on https://www.npmjs.com/package/serdes) and serialize/deserialize the C++ objects yourself. For objects that Node.js transfers internally, like the |
@addaleax thanks, things are getting clearer.
Me, too, actually :) I'm just considering every option here. Also, you said:
Does that imply that there would be a way to transfer custom objects without extra serialization and deserialization? It would be a powerful tool IMO. |
Yes, exactly. For example, when |
@addaleax thank you, now it's clear. Looking forward to it to happen :) I think I'll just close the issue now as I don't have further questions. Thanks again for you help. |
Hi @addaleax
Does Node.js now provide such a public C++ API ? |
Hi, I've been recently playing with worker threads as in version 12.16.3.
The doc explicitly says that you can't pass a C++ backed object via postMessage: https://nodejs.org/dist/latest-v12.x/docs/api/worker_threads.html#worker_threads_port_postmessage_value_transferlist
And this is true, you can't :) The standard makes it pretty obvious.
Any chance someone may shed some light on why is it so? Or even better, maybe someone has already found a workaround?
The text was updated successfully, but these errors were encountered: