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

neels gerrit-no-reply at lists.osmocom.org
Tue Jun 15 13:53:42 UTC 2021


neels has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/75/24675/1

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: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210615/21243510/attachment.htm>


More information about the gerrit-log mailing list