This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
isolates: add _newIsolate() and _joinIsolate() to process object
- Loading branch information
1 parent
8ebe08a
commit 2b0bdc8
Showing
2 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2b0bdc8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like also to have a way to create an isolate and then enter its loop with a thread I created myself. I need this for Android, and this is how it works on the version I did. Were you planning to support something like this?
2b0bdc8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current interface is a stop-gap measure to have something to test against. I'm open to suggestions.
2b0bdc8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went for minimum change to the current API - not necessarily because that's the best API, but to make it easier to track upstream. So I'm sure there is room to improve it.
Anyway, FWIW the Isolate API is here; https://github.com/paddybyers/node/blob/master-isolate/src/node.h#L128
This API forces you to create a thread - and I think your idea of having a method that includes creation of the thread is useful as well - and enter Isolate::Start(). You pass in an argv in the same way as to the regular node::Start(), or alternatively a uv_process_options_t, which is used for fork().
I think the best might be to have two entrypoints; one that creates the thread and one where the caller's thread enters the loop and blocks there.
Are there any special requirements on a caller-supplied thread that enters the loop? Joinable? Or only if the caller itself wants to join()?
2b0bdc8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've thought about it some more, and I was wrong; I'm OK if the library creates the thread for me.
2b0bdc8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. I like the simplicity of that.