From 16deaa9a729e4f15637c79b661c33e08bd1823d7 Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Tue, 23 May 2017 15:10:20 +0200 Subject: [PATCH] timed_semaphore: fix deprecated warning Fixes #2429 --- repos/base/src/lib/ldso/main.cc | 4 ++++ repos/os/include/os/timed_semaphore.h | 6 +++++- repos/os/src/lib/timed_semaphore/timed_semaphore.cc | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/repos/base/src/lib/ldso/main.cc b/repos/base/src/lib/ldso/main.cc index 92fc7f8ba..4cfd4b67d 100644 --- a/repos/base/src/lib/ldso/main.cc +++ b/repos/base/src/lib/ldso/main.cc @@ -19,6 +19,7 @@ #include #include #include +#include /* base-internal includes */ #include @@ -679,6 +680,9 @@ void Component::construct(Genode::Env &env) Link_map::dump(); + /* FIXME: remove 'Timeout_thread' from the base library */ + Timeout_thread::env(env); + binary_ready_hook_for_gdb(); /* start binary */ diff --git a/repos/os/include/os/timed_semaphore.h b/repos/os/include/os/timed_semaphore.h index 7b622eee3..8a2fd1381 100644 --- a/repos/os/include/os/timed_semaphore.h +++ b/repos/os/include/os/timed_semaphore.h @@ -47,7 +47,9 @@ class Genode::Timeout_thread : public Thread_deprecated<2048*sizeof(long)>, enum { JIFFIES_STEP_MS = 10 }; - Timer::Connection _timer; /* timer session */ + static Genode::Env *_env; + + Timer::Connection _timer { *_env }; /* timer session */ Signal_context _context; Signal_receiver _receiver; @@ -68,6 +70,8 @@ class Genode::Timeout_thread : public Thread_deprecated<2048*sizeof(long)>, * Returns the singleton timeout-thread used for all timeouts. */ static Timeout_thread *alarm_timer(); + + static void env(Genode::Env &env) { _env = &env; } }; diff --git a/repos/os/src/lib/timed_semaphore/timed_semaphore.cc b/repos/os/src/lib/timed_semaphore/timed_semaphore.cc index 8701804f6..3458c9b10 100644 --- a/repos/os/src/lib/timed_semaphore/timed_semaphore.cc +++ b/repos/os/src/lib/timed_semaphore/timed_semaphore.cc @@ -14,6 +14,9 @@ #include +Genode::Env *Genode::Timeout_thread::_env = nullptr; + + void Genode::Timeout_thread::entry() { while (true) {