-
Notifications
You must be signed in to change notification settings - Fork 2k
Added a thread killing API #288
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
Conversation
…header that determines whether or not to replace underscores with hyphens. Previously, underscores were replaced unconditionally. Currently each of the functions has another boolean argument. If it's false, underscores would not be touched. If it's true, they would. The default value of the argument is true.
…ptions), in which the only possible option currently is replace_underscores.
ngx.thread.kill - kills a thread. ngx.thread.kill_sleeping - either kills immediately a sleeping thread, or, if the thread is not sleeping, can wait for it to end. Useful for a thread that has a loop in which it sleeps.
…ts when using ngx.thread.kill_sleeping. Now removing the timer.
It seems that this makes kill_sleeping unnecessary, so it was removed.
Several comments on your latest patch:
|
- Added a return value to ngx_http_lua_del_thread(), and checking the return value in the thread killing function. - When ngx_http_lua_get_co_ctx() returns NULL, this now means that the thread is already dead, no need in trying to kill it. - Returning the number of the threads killed successfully. - Not killing threads that have pending subrequests.
@aviramc Yes, you're right. And I need update the uthread.c file in my current master branch as well :) |
…"light thread". thanks aviramc for the original patch in #288.
@aviramc BTW, I removed the multi-argument support because it makes JIT compiling impossible for FFI-based implementations. |
@aviramc Nice catch! Some how I missed that :P Will fix it :) |
…"light thread". thanks aviramc for the original patch in #288.
…"light thread". thanks aviramc for the original patch in #288.
This feature has already been included in the |
Added ngx.thread.kill that gets a list of Lua threads and kills them.
This includes the comments by @agentzh to the cleanup of the threads.
I've also removed the function ngx.thread.kill_sleeping, and it seems to be not useful anymore.
The is a part of pull request #286