-
-
Save methodmissing/120856 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static void | |
| rb_kill_thread(th, flags) | |
| rb_thread_t th; | |
| int flags; | |
| { | |
| if (th != curr_thread && th->safe < 4) { | |
| rb_secure(4); | |
| } | |
| if (th->status == THREAD_TO_KILL || th->status == THREAD_KILLED) | |
| return; | |
| if (th == th->next || th == main_thread) rb_exit(EXIT_SUCCESS); | |
| rb_thread_ready(th); | |
| th->flags |= flags; | |
| th->status = THREAD_TO_KILL; | |
| if (!rb_thread_critical) rb_thread_schedule(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| VALUE | |
| rb_thread_kill(VALUE thread) | |
| { | |
| rb_thread_t *th; | |
| GetThreadPtr(thread, th); | |
| if (th != GET_THREAD() && th->safe_level < 4) { | |
| rb_secure(4); | |
| } | |
| if (th->status == THREAD_TO_KILL || th->status == THREAD_KILLED) { | |
| return thread; | |
| } | |
| if (th == th->vm->main_thread) { | |
| rb_exit(EXIT_SUCCESS); | |
| } | |
| thread_debug("rb_thread_kill: %p (%p)\n", (void *)th, (void *)th->thread_id); | |
| rb_thread_interrupt(th); | |
| th->thrown_errinfo = eKillSignal; | |
| th->status = THREAD_TO_KILL; | |
| return thread; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment