Skip to content
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

Node.js worker thread API #380

Merged
merged 4 commits into from
Sep 19, 2024
Merged

Node.js worker thread API #380

merged 4 commits into from
Sep 19, 2024

Conversation

jasongin
Copy link
Member

  • Add NodeWorker class to wrap the Node.js worker thread API
    • At the moment there is a limitation in that it doesn't support JS/.NET interop in the worker thread. (The JS worker can still communicate with the .NET host via messages.) Direct interop in the worker will require some of the changes in the libnode embedding API that @vmoroz is working on now, specifically to allow the embedding host to provide modules.
  • Add NodeProcess class to wrap a small subset of the Node.js process API, which is useful for workers (mostly for C# interop in workers which is not done yet).
  • Add JSObjectDictionary adapter that supports adapting a JS object to an IDictionary with value conversions.
    • It's similar to the Map dictionary adapter except JS objects have slightly different semantics than maps.
    • This is used with the NodeProcess.Env to project the env JS object as IDictionary<string, string>.
  • Fix a bug in NodeStream.ReadAsync(), and improve validation in the NodeStream constructor.

@jasongin jasongin requested a review from vmoroz September 18, 2024 07:58
Copy link
Member

@vmoroz vmoroz left a comment

Choose a reason for hiding this comment

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

:shipit:

@jasongin jasongin merged commit aa2ce51 into main Sep 19, 2024
24 checks passed
@jasongin jasongin deleted the dev/jasongin/workers branch September 19, 2024 04:17
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