]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Task-in-limit checker hacked for mainloop
authorMaria Matejka <mq@ucw.cz>
Sat, 8 Jun 2024 21:43:37 +0000 (23:43 +0200)
committerMaria Matejka <mq@ucw.cz>
Wed, 12 Jun 2024 12:48:33 +0000 (14:48 +0200)
sysdep/unix/io-loop.c

index ddf190b0fddc61c22bf2078fa0e30ca402cd8e2e..9d0fa138f62584172287ba96a4528426812454b1 100644 (file)
@@ -1358,7 +1358,11 @@ cmd_show_threads(int show_loops)
 
 _Bool task_still_in_limit(void)
 {
-  return ns_now() < account_last + this_thread->max_loop_time_ns;
+  static u64 main_counter = 0;
+  if (this_birdloop == &main_birdloop)
+    return (++main_counter % 2048);    /* This is a hack because of no accounting in mainloop */
+  else
+    return ns_now() < account_last + this_thread->max_loop_time_ns;
 }
 
 _Bool task_before_halftime(void)