-
Notifications
You must be signed in to change notification settings - Fork 121
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
Promise wrapped nbind functions blocks #100
Comments
I setup an minimal example project, that shows the issue: https://github.com/neophob/nbind-blocking Tested with node v6 and v8. So I guess to fix this behaviour I should use libuv threads (either native or using wrappers like NaN should provide some help) and callbacks. can you point me to an example where this is used? |
Ok the correct way to address cpu bound tasks (or tasks which run long time) is using the libuv worker threads (uv_queue_work) so the EventLoop is not blocked I found a excellent example here: but I have now the problem, that I cannot when I call
When I use this code, i get this error
|
I have a c function that might take several seconds to complete. So I wrap that call as a promise in the JS part of the code. I use this code in a express server - and while the c code is running, express does not answers any requests. this means the c code blocks. here's a little example
My JS code calls this function like this:
Question:
The text was updated successfully, but these errors were encountered: