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

JS eventloop on worker thread #13

Open
jolcese opened this issue Apr 25, 2013 · 2 comments
Open

JS eventloop on worker thread #13

jolcese opened this issue Apr 25, 2013 · 2 comments

Comments

@jolcese
Copy link
Collaborator

jolcese commented Apr 25, 2013

I've been doing some tests with workers and I realize that several async functions (e.g. setInterval, setTimer, xhr requests, etc) are not working inside threads.
I understand that this happens because of the lack of a "true" JS eventLoop in th thread.
Is this something that can be implemented? How hard it is?

@audreyt
Copy link
Owner

audreyt commented Apr 27, 2013

It is possible by copying over Node's own uv_timer_t implementations, since we share the same event loop with the underlying JS code.

XHR requests will require porting something like https://github.com/rob333/thread.js/blob/master/src/simple_http.cc to our context.

All in all quite possible, but I'm afraid I'm a bit short on tuits (available cycles) in the next few weeks. If anyone would like to take a sketch at it, I'd be very happy to give out commit bits and/or take pull requests.

@DiThi
Copy link

DiThi commented Apr 24, 2014

I just found this problem... I need to use XHR, and the xhr2 module uses http.Agent and https.Agent.

I may work around it with a shim that makes requests to the main thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants