[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH] libc: Race-Condition beim Registrieren von Timern
! libc: Race-Condition beim Registrieren von Timern behoben
Signed-off-by: Antoine Kaufmann <toni@xxxxxxxxxx>
---
src/modules/lib/rpc/timer.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/modules/lib/rpc/timer.c b/src/modules/lib/rpc/timer.c
index c8e28b9..e4869bb 100644
--- a/src/modules/lib/rpc/timer.c
+++ b/src/modules/lib/rpc/timer.c
@@ -42,6 +42,8 @@ struct timeout {
dword timer_register(void (*callback)(void), dword usec)
{
+ dword id;
+
// Initialisieren der Liste
if (!timers) {
timers = list_create();
@@ -54,6 +56,7 @@ dword timer_register(void (*callback)(void), dword usec)
timeout->timer_id = next_timer_id++;
// An der richtigen Stelle in der Liste einsortieren
+ p();
struct timeout* item;
int i;
for (i = 0; (item = list_get_element_at(timers, i)); i++) {
@@ -66,7 +69,10 @@ dword timer_register(void (*callback)(void), dword usec)
// Timer beim Kernel registrieren
syscall_timer(timeout->timer_id, usec);
- return timeout->timer_id;
+ id = timeout->timer_id;
+ v();
+
+ return id;
}
void timer_callback(dword timer_id)
--
1.6.0.6