mirror of
https://github.com/clearlinux/graphene.git
synced 2026-09-06 05:41:37 +00:00
[LibOS] Instruct thread_exit() to send IPC_CLD_EXIT only once
Previously, when a thread exited via thread_exit(), it could send two identical IPC_CLD_EXIT messages under certain conditions. This commit fixes this bug and forces thread_exit() to send IPC_CLD_EXIT at most once.
This commit is contained in:
@@ -44,10 +44,14 @@ void release_clear_child_id (int * clear_child_tid);
|
||||
|
||||
int thread_exit(struct shim_thread * self, bool send_ipc)
|
||||
{
|
||||
bool sent_exit_msg = false;
|
||||
|
||||
/* Chia-Che: Broadcast exit message as early as possible,
|
||||
so other process can start early on responding. */
|
||||
if (self->in_vm && send_ipc)
|
||||
if (self->in_vm && send_ipc) {
|
||||
ipc_cld_exit_send(self->ppid, self->tid, self->exit_code, self->term_signal);
|
||||
sent_exit_msg = true;
|
||||
}
|
||||
|
||||
lock(&self->lock);
|
||||
|
||||
@@ -99,7 +103,7 @@ int thread_exit(struct shim_thread * self, bool send_ipc)
|
||||
unlock(&parent->lock);
|
||||
|
||||
DkEventSet(parent->child_exit_event);
|
||||
} else {
|
||||
} else if (!sent_exit_msg) {
|
||||
debug("parent not here, need to tell another process\n");
|
||||
ipc_cld_exit_send(self->ppid, self->tid, self->exit_code, self->term_signal);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user