Change in libosmocore[master]: timer.c: make timers thread safe

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/.

Hoernchen gerrit-no-reply at lists.osmocom.org
Sun Apr 19 00:21:41 UTC 2020


Hoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/17862 )


Change subject: timer.c: make timers thread safe
......................................................................

timer.c: make timers thread safe

This is implicitly used by the libosmocore select abstraction, which
might be used in multiple threads at the same time.

Change-Id: I5a3802c94af6ff0315f1553f20870342d51ce726
---
M src/timer.c
1 file changed, 3 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/62/17862/1

diff --git a/src/timer.c b/src/timer.c
index 0b2e3dd..d3129a7 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -40,10 +40,10 @@
 #include <osmocom/core/linuxlist.h>
 
 /* These store the amount of time that we wait until next timer expires. */
-static struct timeval nearest;
-static struct timeval *nearest_p;
+static __thread struct timeval nearest;
+static __thread struct timeval *nearest_p;
 
-static struct rb_root timer_root = RB_ROOT;
+static __thread struct rb_root timer_root = RB_ROOT;
 
 static void __add_timer(struct osmo_timer_list *timer)
 {

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I5a3802c94af6ff0315f1553f20870342d51ce726
Gerrit-Change-Number: 17862
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200419/e1e28ed3/attachment.htm>


More information about the gerrit-log mailing list