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
This commit is contained in:
Eric Wild 2020-04-19 02:09:28 +02:00
parent a70ac85f5b
commit 06747d5720
1 changed files with 3 additions and 3 deletions

View File

@ -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)
{