Change in libosmocore[master]: select_main: don't poll forever during 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
Tue Dec 28 12:14:12 UTC 2021


neels has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26663 )

Change subject: select_main: don't poll forever during shutdown
......................................................................

select_main: don't poll forever during shutdown

Do not poll without timeout during shutdown if no timers are pending.

Change-Id: I81c64a7ae440304522c2179c212023a566ddced8
---
M src/select.c
1 file changed, 8 insertions(+), 2 deletions(-)

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



diff --git a/src/select.c b/src/select.c
index b48d13e..ddff132 100644
--- a/src/select.c
+++ b/src/select.c
@@ -372,14 +372,20 @@
 {
 	unsigned int n_poll;
 	int rc;
+	int timeout = 0;
 
 	/* prepare read and write fdsets */
 	n_poll = poll_fill_fds();
 
-	if (!polling)
+	if (!polling) {
 		osmo_timers_prepare();
+		timeout = osmo_timers_nearest_ms();
 
-	rc = poll(g_poll.poll, n_poll, polling ? 0 : osmo_timers_nearest_ms());
+		if (_osmo_select_shutdown_requested && timeout == -1)
+			timeout = 0;
+	}
+
+	rc = poll(g_poll.poll, n_poll, timeout);
 	if (rc < 0)
 		return 0;
 

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I81c64a7ae440304522c2179c212023a566ddced8
Gerrit-Change-Number: 26663
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
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/20211228/d176bb96/attachment.htm>


More information about the gerrit-log mailing list