-
Notifications
You must be signed in to change notification settings - Fork 142
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
Terminating a thread #45
Comments
The current implementation of |
Any way to change or hack |
I believe you can do: function foo() {
if (!kill) {
DO_STUFF
thread.nextTick(foo);
}
}
thread.eval('kill=false').eval(foo).eval('foo()'); and then to kill: thread.eval('kill=true'); The idea is to have the thread treat the loop as a queue of work, which |
On 19/05/2014, at 22:22, jnfeinstein wrote:
Nope, .destroy(true) won't work... sorry. A while(1); can't be killed properly, because if TAGG attempted to kill the pthread forcefully from C (it doesn't) then the v8 engine wouldn't be given the oportunity to exit properly and cleanly. IOW, I tried and it made v8 crash. I don't know, perhaps now there's a way to tell v8 to kill a while(1);, but last time I checked there wasn't. |
I was confusing destroy thread with destroy pool. On Monday, May 19, 2014, xk [email protected] wrote:
|
I'm having the same issue where operations on large files should be terminated after a set timeout. It's very hard to include next.processTicks in these methods because they belong to external libraries. |
I'm trying to figure out a way how a piece of Javascript code can be forced to terminate its execution. I've tried to use your library like this:
It doesn't work though. Method does not interrupt what is executing already. Is there a way to achieve this in Javascript?
I know that this task is not really common in node.js programming, but this is absolutely mandatory in my project's needs.
The text was updated successfully, but these errors were encountered: