Skip to content

Conversation

petkaantonov
Copy link
Contributor

This will enable implementing a worker class that is backed by a thread instead of a separate process.

/cc @bnoordhuis

P.S. I saw your todo comments about using uv_default_loop, I was thinking why not have the main thread use the default loop and workers use their own loops?

src/node.cc Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Style: void* arg

Copy link
Member

Choose a reason for hiding this comment

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

If StartNodeInstance() is not used elsewhere, it should be static or inline (they amount to the same thing, non-external linkage.)

@bnoordhuis
Copy link
Member

I saw your todo comments about using uv_default_loop, I was thinking why not have the main thread use the default loop and workers use their own loops?

I'm not sure what comment that was but it sounds reasonable.

@vkurchatkin
Copy link
Contributor

Why do we need another class for this? Isn't Environment enough?

@petkaantonov
Copy link
Contributor Author

Addressed @bnoordhuis comments, I also added an internal CreateEnvironment overload since in the future we will need to know in env too whether it's the main thread or a worker one.

Why do we need another class for this? Isn't Environment enough?

Instances of this class will be the data argument passed to uv_create_thread, I think it's cleaner if we create Environment while already executing in the thread the environment will belong to.

src/node.cc Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Looking at this again, I think it should be left to the caller to clean up the uv_loop_t. Calling uv_loop_delete() is not safe because we don't know if the loop was created with uv_loop_new() or uv_loop_init().

@bnoordhuis
Copy link
Member

LGTM with comments.

@petkaantonov
Copy link
Contributor Author

Addressed comments, rebased to v1.x and squashed

@petkaantonov
Copy link
Contributor Author

ping

Copy link
Member

Choose a reason for hiding this comment

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

Indent error.

@bnoordhuis
Copy link
Member

LGTM apart from a style nit. Land at will.

chrisdickinson pushed a commit that referenced this pull request Mar 5, 2015
@chrisdickinson
Copy link
Contributor

Merged in 4ae64b2. Thanks!

@rvagg
Copy link
Member

rvagg commented Mar 6, 2015

this feels like something that should go into Notable items in the 1.5.0 release notes but I don't really know how best to characterise it for casual readers. Does somebody want to take a stab at a description in #1060 for me before this goes out?

@bnoordhuis
Copy link
Member

It's still completely internal, add-ons or embedders can't use it yet.

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.

5 participants