diff --git a/core/box/tls_sll_drain_box.h b/core/box/tls_sll_drain_box.h index 86517589..13bc1a6e 100644 --- a/core/box/tls_sll_drain_box.h +++ b/core/box/tls_sll_drain_box.h @@ -43,10 +43,14 @@ static inline int tls_sll_drain_is_enabled(void) { const char* env = getenv("HAKMEM_TINY_SLL_DRAIN_ENABLE"); if (env && *env == '0') { g_drain_enable = 0; +#ifndef NDEBUG fprintf(stderr, "[TLS_SLL_DRAIN] Drain DISABLED via ENV\n"); +#endif } else { g_drain_enable = 1; +#ifndef NDEBUG fprintf(stderr, "[TLS_SLL_DRAIN] Drain ENABLED (default)\n"); +#endif } } return g_drain_enable; @@ -62,14 +66,20 @@ static inline uint32_t tls_sll_drain_get_interval(void) { int val = atoi(env); if (val > 0 && val <= 65536) { g_drain_interval = (uint32_t)val; +#ifndef NDEBUG fprintf(stderr, "[TLS_SLL_DRAIN] Interval=%u (from ENV)\n", g_drain_interval); +#endif } else { g_drain_interval = 2048; +#ifndef NDEBUG fprintf(stderr, "[TLS_SLL_DRAIN] Invalid ENV value, using default=2048\n"); +#endif } } else { g_drain_interval = 2048; +#ifndef NDEBUG fprintf(stderr, "[TLS_SLL_DRAIN] Interval=%u (default)\n", g_drain_interval); +#endif } } return g_drain_interval; diff --git a/core/hakmem.c b/core/hakmem.c index 43deb6e3..29f1a843 100644 --- a/core/hakmem.c +++ b/core/hakmem.c @@ -268,6 +268,7 @@ static inline int hak_init_wait_for_ready(void) { if (pthread_equal(self, g_init_thread)) { return 0; // We are the init thread; caller should take the existing fallback path } + // No timeout: block until init completes to avoid libc fallback on other threads. for (int i = 0; atomic_load_explicit(&g_initializing, memory_order_acquire); ++i) { #if defined(__x86_64__) || defined(__i386__) if (i < 1024) { @@ -277,9 +278,6 @@ static inline int hak_init_wait_for_ready(void) { { sched_yield(); } - if (i > 1000000) { - return -1; // Timed out waiting for init; allow libc fallback - } } return 1; // Init completed }