Skip to content

handle plain exit for tasks #2939

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Task.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,14 @@ void Task::wait_exit() {
* it as an indication that the task has execed.
*/
while (true) {
int ret = waitid(P_PID, tid, &info, WSTOPPED | WNOWAIT);
int ret = waitid(P_PID, tid, &info, WEXITED | WSTOPPED | WNOWAIT);
if (ret == 0) {
ASSERT(this, info.si_pid == tid) << "Expected " << tid << " got " << info.si_pid;
int event = WaitStatus(info).ptrace_event();
if (event == 0) { // PTRACE_EVENT_STOP
// already finished
break;
}
if (event == PTRACE_EVENT_EXIT) {
// It's possible that the earlier exit event was synthetic, in which
// case we're only now catching up to the real process exit. In that
Expand Down