mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Ignore dead threads in coroutine_join
.
This commit is contained in:
parent
b8da141d32
commit
1862d961a9
Notes:
git
2021-07-02 09:36:34 +09:00
1 changed files with 7 additions and 3 deletions
|
@ -237,9 +237,13 @@ struct coroutine_context * coroutine_transfer(struct coroutine_context * current
|
|||
static
|
||||
void coroutine_join(struct coroutine_context * context) {
|
||||
if (DEBUG) fprintf(stderr, "coroutine_join:pthread_cancel\n");
|
||||
check("coroutine_join:pthread_cancel",
|
||||
pthread_cancel(context->id)
|
||||
);
|
||||
int result = pthread_cancel(context->id);
|
||||
if (result == -1 && errno == ESRCH) {
|
||||
// The thread may be dead due to fork, so it cannot be joined and this doesn't represent a real error:
|
||||
return;
|
||||
}
|
||||
|
||||
check("coroutine_join:pthread_cancel", result);
|
||||
|
||||
if (DEBUG) fprintf(stderr, "coroutine_join:pthread_join\n");
|
||||
check("coroutine_join:pthread_join",
|
||||
|
|
Loading…
Add table
Reference in a new issue