Change in osmo-msc[master]: osmo-msc main: use osmo_select_shutdown()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

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


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/24753 )


Change subject: osmo-msc main: use osmo_select_shutdown()
......................................................................

osmo-msc main: use osmo_select_shutdown()

Change-Id: I75f4637c051ed44628e65dab1bdbbf28dcc9626f
---
M src/osmo-msc/msc_main.c
1 file changed, 15 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/53/24753/1

diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c
index fcca101..a0f584d 100644
--- a/src/osmo-msc/msc_main.c
+++ b/src/osmo-msc/msc_main.c
@@ -776,14 +776,24 @@
 		}
 	}
 
-	while (!quit) {
+	do {
 		log_reset_context();
 		osmo_select_main_ctx(0);
-	}
 
-	msc_network_shutdown(msc_network);
-	osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
-	sleep(3);
+		/* If the user hits Ctrl-C the third time, just terminate immediately. */
+		if (quit >= 3)
+			break;
+
+		/* Has SIGTERM been received (and not yet been handled)? */
+		if (quit && !osmo_select_shutdown_requested()) {
+			msc_network_shutdown(msc_network);
+			osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
+
+			/* Request write-only mode in osmo_select_main_ctx() */
+			osmo_select_shutdown_request();
+			/* continue the main select loop until all write queues are serviced. */
+		}
+	} while (!osmo_select_shutdown_done());
 
 	log_fini();
 

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

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I75f4637c051ed44628e65dab1bdbbf28dcc9626f
Gerrit-Change-Number: 24753
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/20210623/2a9f6a39/attachment.htm>


More information about the gerrit-log mailing list