Change in osmo-bsc[master]: use osmo_select_shutdown to get rid of SIGTERM sleep

neels gerrit-no-reply at lists.osmocom.org
Wed Jun 23 23:45:52 UTC 2021


neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/24675 )

Change subject: use osmo_select_shutdown to get rid of SIGTERM sleep
......................................................................

use osmo_select_shutdown to get rid of SIGTERM sleep

Change-Id: I9a4a629805c49240b8be412e9def298cdf5bc996
---
M src/osmo-bsc/osmo_bsc_main.c
1 file changed, 5 insertions(+), 3 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  dexter: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 14475ff..2a6c501 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -697,10 +697,12 @@
 	switch (signum) {
 	case SIGINT:
 	case SIGTERM:
+		/* If SIGTERM was already sent before, just terminate immediately. */
+		if (osmo_select_shutdown_requested())
+			exit(-1);
 		bsc_shutdown_net(bsc_gsmnet);
 		osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
-		sleep(3);
-		exit(0);
+		osmo_select_shutdown_request();
 		break;
 	case SIGABRT:
 		/* in case of abort, we want to obtain a talloc report and
@@ -1033,7 +1035,7 @@
 		}
 	}
 
-	while (1) {
+	while (!osmo_select_shutdown_done()) {
 		osmo_select_main_ctx(0);
 	}
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/24675
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I9a4a629805c49240b8be412e9def298cdf5bc996
Gerrit-Change-Number: 24675
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210623/2b47961b/attachment.htm>


More information about the gerrit-log mailing list