[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: handle race between child termination an
From: |
gnunet |
Subject: |
[gnunet] branch master updated: handle race between child termination and us installing the SIGCHLD handler |
Date: |
Mon, 03 Jul 2023 20:12:38 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new c9f09bed8 handle race between child termination and us installing the
SIGCHLD handler
c9f09bed8 is described below
commit c9f09bed813f3629809e28446db3268b552edfd1
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Jul 3 20:12:30 2023 +0200
handle race between child termination and us installing the SIGCHLD handler
---
src/util/child_management.c | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/src/util/child_management.c b/src/util/child_management.c
index 680dbcabe..e78ebac9f 100644
--- a/src/util/child_management.c
+++ b/src/util/child_management.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet
- Copyright (C) 2021 GNUnet e.V.
+ Copyright (C) 2021-2023 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -153,6 +153,7 @@ sighandler_child_death (void)
errno = old_errno; /* restore errno */
}
+
/**
* Initializing the signal pipe for child handling.
*/
@@ -193,20 +194,13 @@ child_management_done (void)
}
-/**
- * Adding a child process to be monitored by the child management.
- *
- * @param proc The child process to be monitored.
- * @param cb The callback to be called, when the child process completed.
- * @param cb_cls The closure for the callback.
- * @return An handle for the the child being monitored.
- */
struct GNUNET_ChildWaitHandle *
GNUNET_wait_child (struct GNUNET_OS_Process *proc,
GNUNET_ChildCompletedCallback cb,
void *cb_cls)
{
struct GNUNET_ChildWaitHandle *cwh;
+ bool may_race = (NULL == sigpipe);
child_management_start ();
cwh = GNUNET_new (struct GNUNET_ChildWaitHandle);
@@ -225,15 +219,14 @@ GNUNET_wait_child (struct GNUNET_OS_Process *proc,
&maint_child_death,
NULL);
}
+ /* Handle race-condition case where the child terminated just before we
+ installed the signal handler and thus we missed the signal. */
+ if (may_race)
+ sighandler_child_death ();
return cwh;
}
-/**
- * Removing child handle.
- *
- * @param cwh The handle to be removed.
- */
void
GNUNET_wait_child_cancel (struct GNUNET_ChildWaitHandle *cwh)
{
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: handle race between child termination and us installing the SIGCHLD handler,
gnunet <=