feat: rename delaymgr precision→precision_ms, replace sleep() with nanosleep() (P0-2b)

- Rename `precision` field to `precision_ms` in delaymgr_t struct (delay.h)
- Replace `sleep(mgr->precision)` with `nanosleep()` for 10ms granularity (delay.c)
- Add `#include <time.h>` to delay.c (already in delay.h)
- Update delaymgr_init() to store precision_ms parameter
- Update all call sites: cluster.c (2→200ms), controller/testsuite/test.c (2→2000ms),
  lib/testsuite/test_delay.c (1→1000ms)
- Add TDD test test_delaymgr_precision_ms_field verifying field exists and stores correctly
- delay_task() delay parameter remains in seconds; only sleep granularity changes
This commit is contained in:
Rongsong Shen 2026-05-07 09:08:03 +00:00
parent 762b59c043
commit 6d4d8eb81d
5 changed files with 23 additions and 6 deletions

View file

@ -23,7 +23,7 @@ typedef struct {
typedef struct {
pthread_t worker;
int running;
int precision;
int precision_ms;
task_run_fn_t runner_fn;
timer_t timerid;
ordq_t tasks;